In my program the main window must be disabled when a message box appears.
In this way the user have to answer the message box before he can go on in the main window.
To do this I wrote the lines 1, 2, 3 and 5 in the callback function Button_Click (see below),
but the main window was in the background after the message box was answered.
After I added line 4 the main window gets to the foreground but now there is a little flicker
because the window disappears and reappears.
And now my question: Is there a way to disable and enable the main window without a flicker?
'Here is the program:
#COMPILE EXE
#INCLUDE "Win32api.inc"
GLOBAL hDlg AS LONG
'------------------------------------------------------------------------------
CALLBACK FUNCTION Button_Click() AS LONG
1: DIALOG DISABLE hDlg
2: MSGBOX("Hallo!")
3: DIALOG ENABLE hDlg
4: DIALOG SHOW STATE hDlg, %SW_HIDE
5: DIALOG SHOW STATE hDlg, %SW_SHOWNORMAL
END FUNCTION
'------------------------------------------------------------------------------
FUNCTION PBMAIN() AS LONG
DIALOG NEW 0, "Test-Program", 0,0, 640, 480, %WS_SYSMENU OR %WS_EX_TOPMOST TO hDlg
CONTROL ADD BUTTON, hDlg, 1, "Click me!", 100,100,100,50,,CALL Button_Click
DIALOG SHOW MODAL hDlg
END FUNCTION
------------------
In this way the user have to answer the message box before he can go on in the main window.
To do this I wrote the lines 1, 2, 3 and 5 in the callback function Button_Click (see below),
but the main window was in the background after the message box was answered.
After I added line 4 the main window gets to the foreground but now there is a little flicker
because the window disappears and reappears.
And now my question: Is there a way to disable and enable the main window without a flicker?
'Here is the program:
#COMPILE EXE
#INCLUDE "Win32api.inc"
GLOBAL hDlg AS LONG
'------------------------------------------------------------------------------
CALLBACK FUNCTION Button_Click() AS LONG
1: DIALOG DISABLE hDlg
2: MSGBOX("Hallo!")
3: DIALOG ENABLE hDlg
4: DIALOG SHOW STATE hDlg, %SW_HIDE
5: DIALOG SHOW STATE hDlg, %SW_SHOWNORMAL
END FUNCTION
'------------------------------------------------------------------------------
FUNCTION PBMAIN() AS LONG
DIALOG NEW 0, "Test-Program", 0,0, 640, 480, %WS_SYSMENU OR %WS_EX_TOPMOST TO hDlg
CONTROL ADD BUTTON, hDlg, 1, "Click me!", 100,100,100,50,,CALL Button_Click
DIALOG SHOW MODAL hDlg
END FUNCTION
------------------
Comment