Announcement

Collapse
No announcement yet.

PBCompiler 8.0.4 makes my program do unexpected stuff...

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

  • Roger Garstang
    replied
    Originally posted by Marc Giesmann View Post
    Steve,
    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.
    And it will probably be close to that count since you will get this message when your app goes active and inactive. Might even be more if they are sent during the blinking since this message does relate more to the Titlebar/border of your window. Michael's suggestion for what Activate message would be best since it is when the client area is active you won't have to worry about anything concerning only titlebars and even messages when your app may be in taskbar only, etc.

    Leave a comment:


  • Roger Garstang
    replied
    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.

    Leave a comment:


  • Wayne Diamond
    replied
    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.

    Leave a comment:


  • Marc Giesmann
    replied
    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...

    Leave a comment:


  • Michael Mattias
    replied
    >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.

    Leave a comment:


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

    Leave a comment:


  • Michael Mattias
    replied
    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

    Leave a comment:


  • Marc Giesmann
    replied
    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.

    Leave a comment:


  • Michael Mattias
    replied
    >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

    Leave a comment:


  • Steve Rossell
    replied
    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

    Leave a comment:


  • Marc Giesmann
    replied
    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... ö.Ö

    Leave a comment:


  • Michael Mattias
    replied
    >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

    Leave a comment:


  • Roger Garstang
    replied
    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.

    Leave a comment:


  • Wayne Diamond
    replied
    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?

    Leave a comment:


  • Marc Giesmann
    replied
    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

    Leave a comment:


  • Wayne Diamond
    replied
    How about my sample code - did that also exhibit the behavioral difference?

    Leave a comment:


  • Marc Giesmann
    replied
    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
    '------------------------------------------------------------------------------

    Leave a comment:


  • Wayne Diamond
    replied
    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.

    Leave a comment:


  • Marc Giesmann
    replied
    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 :/

    Leave a comment:


  • Wayne Diamond
    replied
    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

    Leave a comment:

Working...
X