Announcement

Collapse
No announcement yet.

PBCompiler 8.0.4 makes my program do unexpected stuff...

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

  • PBCompiler 8.0.4 makes my program do unexpected stuff...

    Hey

    I am hanging here on some strange behaviours with the new compiler.

    I wrote a little Messenger (I call it LoCo ), which works over LAN, and without a server. But since the upgrade to the new compiler, my program always wants my attention- it blinks in the taskbar.

    So, every time I click on another program, LoCo starts to get orange in the taskbar. If I don't change anything in my code, but activate the old compiler (I still got 8.0.3 here, cause of some more compiling problems with the new one) everything just works fine- or better: as expected.

    Furthermore I just recognized, that LoCo, compiled with 8.0.4, is 2KB bigger than my old one. Thats not much, but I really wonder why.

    Sorry If this topic already exists, but after some very frustrating search-orgies with the forum search I gave up. Or is it possible, that there really is no changelog for 8.0.4? A detailed changelog could be very helpful- I got some more .BAS- files here, which are GPFing the new compiler- without any clues where to begin the "debug".

    Thanks in advance,
    Marc Giesmann

  • #2
    hrm i havent experienced any problems with 8.0.4 yet, but if I was you I'd compile the exe in 8.0.3, then in 8.0.4, then compare the two for differences - in particular calls to CreateWindow/CreateWindowEx. Maybe a window style has changed
    -

    Comment


    • #3
      Originally posted by Wayne Diamond View Post
      hrm i havent experienced any problems with 8.0.4 yet, but if I was you I'd compile the exe in 8.0.3, then in 8.0.4, then compare the two for differences - in particular calls to CreateWindow/CreateWindowEx. Maybe a window style has changed
      So far, so good. Just took OllyDbg to make sure, the styles are the same- and they are.

      ...any other suggestions? Sorry, I am no code-ASM-Master...

      It's exasperating :/

      Comment


      • #4
        Can you make a bare-bones demo that replicates what's happening? For example if you just create a program that has a single dialog, like a Hello World program but with a dialog, do you still get that same behavior difference from 8.0.3 to 8.0.4?

        Does this for example exhibit the same behavior?
        Code:
        #COMPILE EXE
        #INCLUDE "WIN32API.INC"
        
        %DIALOG1 = 101
        
        DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
        DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
        
        CALLBACK FUNCTION ShowDIALOG1Proc()
        END FUNCTION
        
        FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
            LOCAL lRslt AS LONG
            LOCAL hDlg  AS DWORD
            DIALOG NEW hParent, "Dialog1", 70, 70, 119, 70, %WS_POPUP OR %WS_BORDER _
                OR %WS_DLGFRAME OR %WS_THICKFRAME OR %WS_CAPTION OR %WS_SYSMENU OR _
                %WS_MINIMIZEBOX OR %WS_CLIPSIBLINGS OR %WS_VISIBLE OR %DS_MODALFRAME _
                OR %DS_CENTER OR %DS_3DLOOK OR %DS_NOFAILCREATE OR %DS_SETFONT, _
                %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
                %WS_EX_RIGHTSCROLLBAR, TO hDlg
            DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt
            FUNCTION = lRslt
        END FUNCTION
        
        FUNCTION PBMAIN()
            ShowDIALOG1 %HWND_DESKTOP
        END FUNCTION
        Last edited by Wayne Diamond; 8 Jul 2008, 05:02 AM.
        -

        Comment


        • #5
          Got it!

          Heres a sample- tryed it with PB8.0.3 (no blink) and PB8.0.4(blink)
          Code:
          #PBFORMS CREATED V1.51
          #COMPILE EXE
          #DIM ALL
          
          '------------------------------------------------------------------------------
          '   ** Includes **
          '------------------------------------------------------------------------------
          #PBFORMS BEGIN INCLUDES 
          #IF NOT %DEF(%WINAPI)
              #INCLUDE "WIN32API.INC"
          #ENDIF
          #IF NOT %DEF(%RICHEDIT_INC)
              #INCLUDE "RICHEDIT.INC"
          #ENDIF
          #INCLUDE "PBForms.INC"
          #PBFORMS END INCLUDES
          '------------------------------------------------------------------------------
          
          '------------------------------------------------------------------------------
          '   ** Constants **
          '------------------------------------------------------------------------------
          #PBFORMS BEGIN CONSTANTS 
          %IDD_DIALOG_BLINK        = 101
          %IDC_RICHEDIT_HELLOWORLD = 102
          %IDC_RICHEDIT_NOFOCUS    = 103
          #PBFORMS END CONSTANTS
          '------------------------------------------------------------------------------
          
          '------------------------------------------------------------------------------
          '   ** Declarations **
          '------------------------------------------------------------------------------
          DECLARE CALLBACK FUNCTION ShowDIALOG_BLINKProc()
          DECLARE FUNCTION ShowDIALOG_BLINK(BYVAL hParent AS DWORD) AS LONG
          #PBFORMS DECLARATIONS
          '------------------------------------------------------------------------------
          
          '------------------------------------------------------------------------------
          '   ** Main Application Entry Point **
          '------------------------------------------------------------------------------
          FUNCTION PBMAIN()
              PBFormsRichEdit ()      ' Load RichEdit
              ShowDIALOG_BLINK %HWND_DESKTOP
              PBFormsRichEdit (%TRUE) ' Unload RichEdit
          END FUNCTION
          '------------------------------------------------------------------------------
          
          '------------------------------------------------------------------------------
          '   ** CallBacks **
          '------------------------------------------------------------------------------
          CALLBACK FUNCTION ShowDIALOG_BLINKProc()
              STATIC lNCACTIVATE AS LONG
              SELECT CASE AS LONG CBMSG
                CASE %WM_NCACTIVATE
                   INCR lNCACTIVATE
                   IF lNCACTIVATE = 5 THEN
                      CONTROL SET TEXT CBHNDL, %IDC_RICHEDIT_HELLOWORLD, "I should blink now on PB/Win Version 8.04 "
                   END IF
                   
                   'Here's the strange one
                   CONTROL SET FOCUS CBHNDL, %IDC_RICHEDIT_HELLOWORLD
              END SELECT
          END FUNCTION
          '------------------------------------------------------------------------------
          
          '------------------------------------------------------------------------------
          '   ** Dialogs **
          '------------------------------------------------------------------------------
          FUNCTION ShowDIALOG_BLINK(BYVAL hParent AS DWORD) AS LONG
              LOCAL lRslt AS LONG
          
          #PBFORMS BEGIN DIALOG %IDD_DIALOG_BLINK->->
              LOCAL hDlg  AS DWORD
          
              DIALOG NEW hParent, "Blink", 342, 161, 156, 99, %WS_POPUP OR %WS_BORDER _
                  OR %WS_DLGFRAME OR %WS_THICKFRAME OR %WS_CAPTION OR %WS_SYSMENU OR _
                  %WS_MINIMIZEBOX OR %WS_CLIPSIBLINGS OR %WS_VISIBLE OR %DS_MODALFRAME _
                  OR %DS_CENTER OR %DS_3DLOOK OR %DS_NOFAILCREATE OR %DS_SETFONT, _
                  %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
                  %WS_EX_RIGHTSCROLLBAR, TO hDlg
              CONTROL ADD PBFormsRichEdit(), hDlg, %IDC_RICHEDIT_HELLOWORLD, "I want focus after reactivate!", _
                  5, 5, 145, 25, %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP _
                  OR %WS_HSCROLL OR %WS_VSCROLL OR %ES_LEFT OR %ES_MULTILINE OR _
                  %ES_AUTOHSCROLL OR %ES_AUTOVSCROLL OR %ES_WANTRETURN, _
                  %WS_EX_CLIENTEDGE OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
                  %WS_EX_RIGHTSCROLLBAR
              CONTROL ADD PBFormsRichEdit(), hDlg, %IDC_RICHEDIT_NOFOCUS, "I don't want " + _
                  "to have focus after minimizing...!" + $CRLF + $CRLF + "Step 1: Click me" + $CRLF + "Step 2: Click somewhere on the desktop!" + _
                  $CRLF + "Step 3: Do this twice or more.", _
                  5, 40, 145, 55, %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP OR %WS_HSCROLL OR _
                  %WS_VSCROLL OR %ES_LEFT OR %ES_MULTILINE OR %ES_AUTOHSCROLL OR _
                  %ES_AUTOVSCROLL OR %ES_WANTRETURN, %WS_EX_CLIENTEDGE OR _
                  %WS_EX_LEFT OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR
          #PBFORMS END DIALOG
          
              DIALOG SHOW MODAL hDlg, CALL ShowDIALOG_BLINKProc TO lRslt
          
          #PBFORMS BEGIN CLEANUP %IDD_DIALOG_BLINK
          #PBFORMS END CLEANUP
          
              FUNCTION = lRslt
          END FUNCTION
          '------------------------------------------------------------------------------

          Comment


          • #6
            How about my sample code - did that also exhibit the behavioral difference?
            -

            Comment


            • #7
              Your sample code doesn't involve CONTROL SET FOCUS With your simple- sample everything is okay, and not blinking. Try my posted code, and you'll see

              Comment


              • #8
                Its just that I've already upgraded to 8.0.4 and can't readily downgrade back to 8.0.3 at the moment for various reasons so I can't do any comparisons myself, sorry
                Experiment around with it though to try and isolate what's causing the problem ... is CONTROL SET FOCUS causing it?
                -

                Comment


                • #9
                  This may be one for PB to answer. Perhaps Control Set Focus now also sets the foreground window to the control's parent? It is more of a Windows/Microsoft thing. They added that as a security type thing so a window couldn't just set itself to the foreground. I don't think I kept 8.0.3 to test, but either it got in some how through a loophole or never really got focus because the window should always flash if it didn't have focus before. There are tricks like linking to the other app or using API to give your app the ability to steal focus without flashing, but they don't work well...especially when Office Apps are open as they use the same tricks and some of their own, so you get conflicts.
                  sigpic
                  Mobile Solutions
                  Sys Analyst and Development

                  Comment


                  • #10
                    >This may be one for PB to answer

                    "May" be?

                    Here you have code which when compiled with one version, does one thing; when compiled with another does something else.. except they are not supposed to do anything different.

                    Send source code (with all #INCLUDE files) to [email protected] with an explanation.

                    (Although... first I might look for differences in the #INCLUDE files..I think those can change across compiler versions if you take the default install).

                    MCM
                    Michael Mattias
                    Tal Systems (retired)
                    Port Washington WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                    • #11
                      I just did that. Included the .BAS, and a link to this thread. Hope to solve this soon.
                      Thanks everyone, will post feedback ASAIK.
                      Last edited by Marc Giesmann; 8 Jul 2008, 08:07 AM. Reason: My keyboard hates me for some reason... ö.Ö

                      Comment


                      • #12
                        If you want the control to gain focus after the window is activated then you should do:
                        Code:
                        CALLBACK FUNCTION ShowDIALOG_BLINKProc()
                            STATIC lNCACTIVATE AS LONG
                            SELECT CASE AS LONG CBMSG
                              CASE %WM_NCACTIVATE
                                 INCR lNCACTIVATE
                                 IF lNCACTIVATE = 5 THEN
                                    CONTROL SET TEXT CBHNDL, %IDC_RICHEDIT_HELLOWORLD, "I should blink now on PB/Win Version 8.04 "
                                 END IF
                        
                                 IF CBLPARAM = %TRUE THEN
                                   CONTROL SET FOCUS CBHNDL, %IDC_RICHEDIT_HELLOWORLD
                                 ELSE
                                   FUNCTION = %TRUE
                                 END IF
                            END SELECT
                        END FUNCTION
                        Sincerely,

                        Steve Rossell
                        PowerBASIC Staff

                        Comment


                        • #13
                          >If you want the control to gain focus after the window is activated then you should do:

                          I think I would instead test WM_ACTIVATE notification looking for wParam (CBWPARAM) to equal WA_ACTIVE or WA_CLICKACTIVE and set focus to the desired control at that time.

                          (I truly do not understand the STATIC 'activate counter' here. It must be a 'context' thing).

                          Regardless, there is 'something' which changed in the 8.04 compiler. If it's not in the "What's New" documentation (I have not yet upgraded from 8.03 so I don't know), then this should be reported to the proper authorities.



                          MCM
                          Michael Mattias
                          Tal Systems (retired)
                          Port Washington WI USA
                          [email protected]
                          http://www.talsystems.com

                          Comment


                          • #14
                            Steve,
                            Thanks for this workaround, but I still think this is unacceptable- we've got some more programs to maintain. And If the compiler changes, and there is no clue what excatly changed- and after 1 or 2 weeks our customers are confused by some strange happenings, and we don't know where to search for the issue.

                            How do we now, this is the only "little" thing that changed?

                            Hope you understand my problem with this approach.

                            In this case it really helps- but I still don't know, in which cases the compiler just GPFs. I just got the first mail back from powerbasic, I'll give feedback again, ASAIC

                            EDIT
                            Michael,
                            Thats a good idea in this case.

                            BTW:
                            The static counter is just to explain, that on the fourth or fifth time the NCACTIVATE happens, my program starts to blink
                            in the taskbar with PB Win8.04. In fact, thats just a "cosmetical add on" to decribe the problem more accurate.
                            Last edited by Marc Giesmann; 8 Jul 2008, 08:36 AM.

                            Comment


                            • #15
                              The COMPILER (pbwin.exe) is suffering a GPF?

                              That's Bad. Real Bad.

                              I've only been able to make that happen (reproducible) once in seventeen years of using PB products. Oh, wait a minute, that was not a GPF, that was an 'endless loop during compile' which I had to terminate.

                              Bit.... first thing to do is disable any antivirus software running and look for spyware. There have been numerous reports here of viruses, anti-viruses and spyware making Bad Things happen.

                              MCM
                              Michael Mattias
                              Tal Systems (retired)
                              Port Washington WI USA
                              [email protected]
                              http://www.talsystems.com

                              Comment


                              • #16
                                Yep the compiler- and OllyDbg wants to look for this issue
                                And the endless loop... yup. But thats a half year ago.

                                Comment


                                • #17
                                  >And the endless loop... yup. But thats a half year ago.

                                  ???

                                  Mine was about seven years ago. If there was one a half a year ago I must have missed it. I guess I need to pay better attention to the PowerBase forum.
                                  Michael Mattias
                                  Tal Systems (retired)
                                  Port Washington WI USA
                                  [email protected]
                                  http://www.talsystems.com

                                  Comment


                                  • #18
                                    Yeah don't know if this was discussed here, we needed to rearrange much of our code- AFAIK we just changed some MACRO-Functions to real functions. That did the trick- but thats only playing for time...

                                    Comment


                                    • #19
                                      AFAIK we just changed some MACRO-Functions to real functions. That did the trick- but thats only playing for time
                                      Macro functions are just inline functions so maybe its a registers conflict ... try using #REGISTER NONE at the start of those subs/functions, and/or using MACROTEMP statements for variable declaration
                                      Last edited by Wayne Diamond; 8 Jul 2008, 09:25 AM.
                                      -

                                      Comment


                                      • #20
                                        Ok, so the only thing changed was a check for IF CBLPARAM = %TRUE. So, the problem was that you were setting focus when your window wasn't in the forground. Not sounding like this is the compiler's fault...

                                        Sounds like previously the Control Set Focus wasn't working when a window wasn't in focus/active/foreground. When they fixed that bug it exposed yours. In windows you can set the foreground/active window and focus as two different things. Normally you wouldn't want to, but I do use it in things like TaskTray menus I usually set focus to 0 so my window doesn't get any of the keys pressed while in the menu. If you want to activate your app to present something to the user when another is in the foreground then yours will blink unless you use API/tricks to make it active without blinking, otherwise you should only set focus when your app is Active/Foreground.
                                        Last edited by Roger Garstang; 8 Jul 2008, 04:16 PM.
                                        sigpic
                                        Mobile Solutions
                                        Sys Analyst and Development

                                        Comment

                                        Working...
                                        X