Announcement

Collapse
No announcement yet.

Virtual Keys - PB Win bombs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Virtual Keys - PB Win bombs

    Is there a limit to the number of Virtual Keys that can be defined...In any event, in my program I am able to get PBwin bomb out of executing. I have never seen that happen before.

    I have wired it down to number of virtual keys defined. I have it at 13/14 which seems to trigger PB Win to fail...Anyone else seen this behaviour...What might be wrong in my code?

    Thanks for any help...

    #2
    Originally posted by dean goodman View Post
    What might be wrong in my code?
    Difficult to say, as we have not seen it!

    Comment


      #3
      "Virtual key" not found in PB WIN 9.0.0 help file.
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


        #4
        The error occurs in this sequence...If the last line is uncommented, then execution of PBwin terminates...

        IF master$="Open GL Draw" THEN
        DIM ac(15) AS ACCELAPI
        ac(0).fvirt = %fvirtkey : ac(0).key = %vk_left : ac(0).cmd = %wm_user + %vk_left
        ac(1).fvirt = %fvirtkey : ac(1).key = %vk_right : ac(1).cmd = %wm_user + %vk_right
        ac(2).fvirt = %fvirtkey : ac(2).key = %vk_up : ac(2).cmd = %wm_user + %vk_up
        ac(3).fvirt = %fvirtkey : ac(3).key = %vk_down : ac(3).cmd = %wm_user + %vk_down
        ac(4).fvirt = %fvirtkey : ac(4).key = %vk_pgup : ac(4).cmd = %wm_user + %vk_pgup
        ac(5).fvirt = %fvirtkey : ac(5).key = %vk_pgdn : ac(5).cmd = %wm_user + %vk_pgdn
        ac(6).fvirt = %fvirtkey : ac(6).key = ASC(CHR$(72)) : ac(6).cmd = %wm_user +ASC(CHR$(72)) ' h key
        ac(7).fvirt = %fvirtkey : ac(7).key = ASC(CHR$(76)) : ac(7).cmd = %wm_user +ASC(CHR$(76)) ' l key
        ac(8).fvirt = %fvirtkey : ac(8).key = ASC(CHR$(87)) : ac(8).cmd = %wm_user +ASC(CHR$(87)) ' w key
        ac(9).fvirt = %fvirtkey : ac(9).key = ASC(CHR$(71)) : ac(9).cmd = %wm_user +ASC(CHR$(71)) ' h key
        ac(10).fvirt = %fvirtkey : ac(10).key = ASC(CHR$(75)) : ac(10).cmd = %wm_user +ASC(CHR$(75)) ' l key
        ac(11).fvirt = %fvirtkey : ac(11).key = ASC(CHR$(81)) : ac(11).cmd = %wm_user +ASC(CHR$(81)) ' w key
        ac(12).fvirt = %fvirtkey : ac(12).key = ASC(CHR$(82)) : ac(12).cmd = %wm_user +ASC(CHR$(82)) ' r key
        ' ac(13).fvirt = %fvirtkey : ac(13).key = ASC(CHR$(69)) : ac(13).cmd = %wm_user +ASC(CHR$(69)) ' e key
        ACCEL ATTACH hDlggl3d, ac() TO result

        END IF

        Comment


          #5
          Originally posted by dean goodman View Post
          The error occurs in this sequence...If the last line is uncommented, then execution of PBwin terminates...
          Dean, it compiles fine here,

          '
          Code:
          'PBWIN 9.00 - WinApi 05/2008 - XP Pro SP3
          #Dim All 
          #Compile Exe  
          #Include "WIN32API.INC"
          '
            Global hdlg As Dword                
            Global Dlg_Hght&, Dlg_Wdth&
          '
          Macro Common_Locals 'Macro easier than retyping and maintains coding consistency
            Local ctr&, ln&, ln1&, i&, s$
            Local hght&, wd&, Longest&, l$
            Local Row&, col&
          End Macro  
          '
          CallBack Function Dialog_Processor
            Select Case CbMsg     'This is TO determine the message TYPE 
               '       
               Case %WM_INITDIALOG'<- Initialiaton when the program loads 
               '
               Case %WM_SYSCOMMAND 'Traps Any Alt key but only F4 closes              
               '
               Case %WM_COMMAND  'This processes command messages
                 Select Case CbCtl
                   'Case %Id_
                     Select Case CbCtlMsg
                     End Select
                 End Select
            End Select
          End Function
          '
          Function PBMain
            Dialog New Pixels, hdlg, "Demo", , , 400, 400, %WS_SYSMENU To hdlg  
          ' Local hDlggl3d As Dword
           Local s As String             
           Local result As Long
            
          Dim ac(15) As ACCELAPI
          ac(0).fvirt = %fvirtkey : ac(0).key = %vk_left : ac(0).cmd = %wm_user + %vk_left
          ac(1).fvirt = %fvirtkey : ac(1).key = %vk_right : ac(1).cmd = %wm_user + %vk_right
          ac(2).fvirt = %fvirtkey : ac(2).key = %vk_up : ac(2).cmd = %wm_user + %vk_up
          ac(3).fvirt = %fvirtkey : ac(3).key = %vk_down : ac(3).cmd = %wm_user + %vk_down
          ac(4).fvirt = %fvirtkey : ac(4).key = %vk_pgup : ac(4).cmd = %wm_user + %vk_pgup
          ac(5).fvirt = %fvirtkey : ac(5).key = %vk_pgdn : ac(5).cmd = %wm_user + %vk_pgdn
          ac(6).fvirt = %fvirtkey : ac(6).key = Asc(Chr$(72)) : ac(6).cmd = %wm_user +Asc(Chr$(72)) ' h key
          ac(7).fvirt = %fvirtkey : ac(7).key = Asc(Chr$(76)) : ac(7).cmd = %wm_user +Asc(Chr$(76)) ' l key
          ac(8).fvirt = %fvirtkey : ac(8).key = Asc(Chr$(87)) : ac(8).cmd = %wm_user +Asc(Chr$(87)) ' w key
          ac(9).fvirt = %fvirtkey : ac(9).key = Asc(Chr$(71)) : ac(9).cmd = %wm_user +Asc(Chr$(71)) ' h key
          ac(10).fvirt = %fvirtkey : ac(10).key = Asc(Chr$(75)) : ac(10).cmd = %wm_user +Asc(Chr$(75)) ' l key
          ac(11).fvirt = %fvirtkey : ac(11).key = Asc(Chr$(81)) : ac(11).cmd = %wm_user +Asc(Chr$(81)) ' w key
          ac(12).fvirt = %fvirtkey : ac(12).key = Asc(Chr$(82)) : ac(12).cmd = %wm_user +Asc(Chr$(82)) ' r key
           ac(13).fvirt = %fvirtkey : ac(13).key = Asc(Chr$(69)) : ac(13).cmd = %wm_user +Asc(Chr$(69)) ' e key
          Accel Attach hDlg, ac() To result '<<<<<<< only changed handle name
            
               Dialog Show Modal hDlg   Call Dialog_Processor
          End Function 'Applikation fursvhtunken
          '
          It's a pretty day. I hope you enjoy it.

          Gösta

          JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
          LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

          Comment


            #6
            Less code provided, so can't help for sure, but you can try these:

            1. Move out the DIM ac() from if block and make it global. Redim it from 0 to 15 in initialization module.
            2. Check you code where boundaries of ac() might be changed by thread/sub/function. Just check out the code for an ac() array
            3. You forgot to say 'Debug' --- simply, debug your application

            Comment


              #7
              Dean,
              have you checked the value of ERR after you DIM your array?

              Paul.

              Comment


                #8
                Suggestions to test array bounds or ERR, or consider the effects of other threads of execution are not very useful until the program compiles.

                I read the problem as "won't compile."

                I have another way to get the compiler (pbwin.exe 9.0.0) to fail on a GPF if anyone needs it.
                Michael Mattias
                Tal Systems (retired)
                Port Washington WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                  #9
                  MCM,
                  I read the problem as "compiled application ceased running without reporting an error". We'll have to wait for clarification from Dean.

                  Paul.

                  Comment


                    #10
                    Geez fellas. What Dean actually said was:
                    Is there a limit to the number of Virtual Keys that can be defined...
                    then later -
                    Originally posted by dean goodman View Post
                    The error occurs in this sequence...If the last line is uncommented, then execution of PBwin terminates...
                    After which I compiled (and posted) his posted code without error, demostraing there is no inherent limit to the number of VK's allowed, or is at least more than 14.

                    ==========================
                    "A small daily task,
                    if it be really daily,
                    will beat the labors
                    of a spasmodic Hercules."
                    Anthony Trollope (1815 - )
                    ==========================
                    It's a pretty day. I hope you enjoy it.

                    Gösta

                    JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                    LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                    Comment


                      #11
                      Sorry for the late response...

                      Taking the DIM statement out of the If block seems to solve the problem...that leads me to believe there is something else going on...but it is working now with no limit on the virtual keys...thx...

                      Comment


                        #12
                        >Taking the DIM statement out of the If block seems to solve the problem

                        If that is a second (or third...) DIM statment for that array in that procedure, it is ignored. REDIM is always obeyed. If it's your application (versus pbwin.exe) which is terminating abnornally, that would explain it.
                        Michael Mattias
                        Tal Systems (retired)
                        Port Washington WI USA
                        [email protected]
                        http://www.talsystems.com

                        Comment


                          #13
                          Dean,
                          are you accessing ac() elsewhere? If so, should the IF loop not be executed then ac() will not be dimmed and may be undefined so if you access ac() elsewhere then you'll be accessing undefined locations in memory which could cause your problem.

                          Paul.

                          Comment

                          Working...
                          X
                          😀
                          🥰
                          🤢
                          😎
                          😡
                          👍
                          👎