Announcement

Collapse
No announcement yet.

4.04 versus 4.03

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

  • 4.04 versus 4.03

    What differences are there between the executables created by PBCC 4.03 and 4.04?

    One is that the 4.04 exe file is a little larger, but there must be other differences ...

    I have a program which when compiled with 4.04 runs as when compiled with 4.03, except for one thing. Clicking the left mouse button disables a certain feature – call it feature D for now.

    After feature D is thus disabled, if a window is created (API call CreateWindowEx) and shown (ShowWindow) then feature D will work again. And will get disabled again if the left mouse button be clicked again.

    All of this is on a graphic window with the console off. What is feature D, you ask? It’s using the keyboard. The keyboard itself is not disabled though, the sub-classing is (evidently) and the keystrokes don’t get through to the graphic window.

    What’s puzzling is that this problem is confined to left-clicking. Right-clicking works fine (doesn’t disable keystrokes), yet the code is completely symmetrical: the left and right buttons are handled with separate but identical code.

    And, to repeat, the program works fine compiled with 4.03.

    Any ideas?
    Politically incorrect signatures about immigration patriots are forbidden. Searching “immigration patriots” is forbidden. Thinking about searching ... well, don’t even think about it.

  • #2
    Mark,

    I think I see something very similar with PBW8.04.
    See my post in that forum.
    I've sent an email to tech support.

    Bill

    Comment


    • #3
      Thanks. I went over to the PBWIN forum and looked, but not being a PBWIN programmer I can’t run your code or even understand much of it.

      Despite the .01 numerically tiny change in release numbers the new compilers are major rewrites – 16 bit to 32 bit assembly code (the result of course was always 32 bit) – and some wrinkle is not too surprising even with the doubtless extensive testing before they went out.

      It takes the ignorant masses to really test something!
      Politically incorrect signatures about immigration patriots are forbidden. Searching “immigration patriots” is forbidden. Thinking about searching ... well, don’t even think about it.

      Comment


      • #4
        Don't forget to check if any of the Windows' header files were changed.

        That can cause different behavior, too! (especially stuff like "right click doesn't do what it used to do).
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          Thanks for your response. I'm not sure I understand what Windows header files are. The update didn't change the Win32API.inc file. (Also my program doesn't use that file, I copy the declares the program needs and then put them in the main code file.) And of course a change with such an effect in itself would be a problem.

          ADDED: I’d said the 4.04 exe file is a little larger than 4.03's. That was the case with the particular program mentioned, but in general sometimes, maybe usually, it’s smaller.
          Last edited by Mark Hunter; 20 Oct 2007, 07:59 PM. Reason: addition
          Politically incorrect signatures about immigration patriots are forbidden. Searching “immigration patriots” is forbidden. Thinking about searching ... well, don’t even think about it.

          Comment


          • #6
            I’ve sent this to PB support.

            The following little program creates InKey and InStat like functions for a graphic window. The mouse is integrated with the keyboard in that a mouse click inserts codes into the same buffer as the keyboard.

            First compile and run under PBCC 4.03 and do the following:

            1. Press some random letters. They’ll appear on the screen.
            2. Click anywhere. The word “mouse” will appear.
            3. Press some more letters. They’ll appear as before.

            Then compile and run under PBCC 4.04 and do the same. This is what I observe (at least under Windows 98):

            1. As before.
            2. As before, but Left click at least once.
            3. Press some more letters. Nothing appears. (Since Esc
            is used to exit, you’ll need to press Ctrl-Alt-Del and
            exit the task from Windows.)

            In PBCC 4.04 left-clicking seems to affect subclassing for the keyboard.

            Code:
             #Dim All
             #Console Off
            '-----------------------------------------------------------------
            
             Macro False   = 0
             Macro True    = -1
             Macro Boolean = Long
            '-----------------------------------------------------------------
            
             %esc   = 27             'ascii keycodes
             %enter = 13
             %lowerA = 97 :%lowerZ = 122
            
             %leftbutton  =  1       'arbitrary buttondown values
             %rightbutton = -1
             %nobutton    =  0
            '-----------------------------------------------------------------
            
             'From WinAPI
             %WM_KEYDOWN    = &H100
             %WM_KEYUP      = &H101
             %WM_SYSKEYDOWN = &H104
             %WM_SYSKEYUP   = &H105
             %WM_SYSCOMMAND = &H112
             %SC_KEYMENU    = &HF100&
             %SC_CLOSE      = &HF060&
             %GWL_WNDPROC   = -4
            
             %WM_NCHITTEST     = &H084
             %HTTRANSPARENT    = -1
             %WM_LBUTTONDOWN   = &H201
             %WM_RBUTTONDOWN   = &H204
             %WM_LBUTTONUP     = &H202
             %WM_RBUTTONUP     = &H205
             %GW_DEPENDENT     = 5
             %HTCLIENT         = 1
            
             Type KeyState
              repeatcount As Bit*16 In Dword
              scancode    As Bit*8
              extendkey   As Bit*1      '1 if right Alt or Ctrl
              reserve1    As Bit*4
              context     As Bit*1      '1 if Alt down when key pressed
              previous    As Bit*1      '1 if down, 0 if up
              transstate  As Bit*1      'always 0
             End Type
            
             Union Syskey
              value As Dword
              KeyState
             End Union
            
             Declare Function GetWindow      Lib "USER32.DLL" Alias "GetWindow" (ByVal Wnd As Dword, ByVal wCmd As Dword) As Long
             Declare Function CallWindowProc Lib "USER32.DLL" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Dword, ByVal Wnd As Dword, ByVal uMsg As Dword, ByVal param As Dword, ByVal mousepos As Long) As Long
             Declare Function SetWindowLong  Lib "USER32.DLL" Alias "SetWindowLongA" (ByVal Wnd As Dword, ByVal nIndex As Long, ByVal lNewLong As Long) As Long
            '-----------------------------------------------------------------
            
             Declare Function GWnew_k(ByVal Dword, ByVal Dword, ByVal Dword, ByVal Long) As Long
             Declare Function GWnew1(ByVal Dword, ByVal Dword, ByVal Dword, ByVal Long) As Long
             Declare Function InStat1 As Long
             Declare Function InKey1 As Long
             Declare Sub StuffKey(ByVal Long)
             Declare Sub GetKey
            
             Declare Sub MouseClick1(ByVal Long)
            '-----------------------------------------------------------------
            
             Global GW1, GWold1, GWold1k As Dword   'handles
             Global win1 As Dword        'handle for window
             Global ky As Long           'keycode
             Global keybuff() As Long    'keycode buffer
             Global nkey As Long         'number of keys in keycode buffer
             Global buttondown As Long              'for mouse buttons
             Global Xmouse, Ymouse As Long
            '-----------------------------------------------------------------
            
             Sub Stuffkey(ByVal ky As Long)
              keybuff(nkey) = ky
              Incr nkey
             End Sub
            
             Function InStat1 As Boolean
              Function = (nkey <> 0)
             End Function
            
             Function InKey1 As Long            'ascii, and always uppercase
              If nkey Then
               Decr nkey
               Function = keybuff(nkey)
              End If
             End Function
            
             Sub GetKey
              Dim count As Long                 'sleep 0 once every five iterations
              Do Until InStat1
               Incr count
               If count = 5 Then
                count = 0
                Sleep 0
               End If
              Loop
              ky = InKey1
             End Sub
            '-----------------------------------------------------------------
            
             Sub MouseClick1(ByVal whichbutton As Boolean)
               If whichbutton = %leftbutton Then
                Stuffkey Asc("e")
                Stuffkey Asc("s")
                Stuffkey Asc("u")
                Stuffkey Asc("o")
                Stuffkey Asc("m")
               Else            '%rightbutton
                Stuffkey Asc("E")
                Stuffkey Asc("S")
                Stuffkey Asc("U")
                Stuffkey Asc("O")
                Stuffkey Asc("M")
               End If
             End Sub
            '-----------------------------------------------------------------
            
             Function GWnew_k (ByVal Wnd As Dword, ByVal Msg As Dword, ByVal Param As Long, ByVal OtherParam As Long) As Long
               Dim ks As Syskey
            
               Select Case Long Msg
               Case %WM_KEYDOWN
                 Stuffkey Param                         'always uppercase
               Case %WM_SYSCOMMAND
                If     (Param And &HFFF0) = %SC_CLOSE Then
                 Stuffkey %esc
                 Exit Function
                End If
               End Select
            
               Function = CallWindowProc(GWold1k, Wnd, Msg, param, OtherParam)
             End Function
            '-----------------------------------------------------------------
            
             Function GWnew1 (ByVal Wnd As Dword, ByVal Msg As Dword, ByVal param As Dword, ByVal mousepos As Long) As Long
               Dim result As Long
            
               result = CallWindowProc (GWold1, Wnd, Msg, param, mousepos)
            
               Select Case Long Msg
               Case %WM_NCHITTEST
                If result = %HTTRANSPARENT Then result = %HTCLIENT
            
               Case %WM_LBUTTONDOWN
                If Wnd = GW1 Then
                 buttondown = %leftbutton
                 Xmouse = Lo(Word,mousepos) :Ymouse = Hi(Word,mousepos)
                End If
               Case %WM_LBUTTONUP
                If Wnd = GW1 Then
                 buttondown = %nobutton
                 Xmouse = Lo(Word,mousepos) :Ymouse = Hi(Word,mousepos)
                 MouseClick1 %leftbutton
                End If
            
               Case %WM_RBUTTONDOWN
                If Wnd = GW1 Then
                 buttondown = %rightbutton
                 Xmouse = Lo(Word,mousepos) :Ymouse = Hi(Word,mousepos)
                End If
               Case %WM_RBUTTONUP
                If Wnd = GW1 Then
                 buttondown = %nobutton
                 Xmouse = Lo(Word,mousepos) :Ymouse = Hi(Word,mousepos)
                 MouseClick1 %rightbutton
                End If
               End Select
            
               Function = result
             End Function
            '-----------------------------------------------------------------
            
             Function PBMain
              Dim keybuff(10)
            
              Graphic Window "", 0,0, 800,400 To win1          'create graphic window
              Graphic Attach win1,0, ReDraw
            
              GW1     = GetWindow(win1, %GW_DEPENDENT)         'subclass
              GWold1  = SetWindowLong(GW1, %GWL_WNDPROC, CodePtr(GWnew1))
              GWold1k = SetWindowLong(win1, %GWL_WNDPROC, CodePtr(GWnew_k))
            
              buttondown = %nobutton
            
              Graphic Font "Times New Roman", 12, 0            'not bold
              Graphic Print "Type some letters or numbers. They'll appear below, uppercase."
              Graphic Print "Left or right click anywhere and respectivley 'mouse' or 'MOUSE' will appear."
              Graphic Print "Press Esc to quit."
              Graphic Print
              Graphic ReDraw
              Graphic Font "Times New Roman", 12, 1            'bold
            
              Do
               Getkey
               If ky = %esc Then Exit Loop
               If ky = %enter Then                             'new line
                Graphic Print "[cr]"
                Graphic Print
               Else
                Graphic Print Chr$(ky);
               End If
               Graphic ReDraw
              Loop
             End Function
            Politically incorrect signatures about immigration patriots are forbidden. Searching “immigration patriots” is forbidden. Thinking about searching ... well, don’t even think about it.

            Comment


            • #7
              A Dialog, Not a Soliloquy

              Is it just me? How about on your machine-O/S ?
              Politically incorrect signatures about immigration patriots are forbidden. Searching “immigration patriots” is forbidden. Thinking about searching ... well, don’t even think about it.

              Comment


              • #8
                Hi Mark,

                Same thing happens here on XP Pro SP2. However, I also noticed that once the program stops responding to the keyboard, if I Alt-Tab away from it and back again, it starts responding again. :dontknow:

                Regards,

                Pete.

                Comment

                Working...
                X