Posts: 1,000
Threads: 253
Joined: Feb 2008
how do you write a dialog window that runs completely hidden?
Posts: 1,000
Threads: 253
Joined: Feb 2008
Posts: 12,073
Threads: 140
Joined: Dec 2002
Function
dlg_hidden
\Dialog_Editor
;Note: This is for QM < 2.3.3. In QM 2.3.3 an later, simply use flag 128 with ShowDialog.
;How to run a dialog invisible?
;Removing WS_VISIBLE style does not work, because Windows always shows modal dialogs.
;The answer: the dialog must be nonmodal.
;However working with nonmodal dialogs is more difficult.
;1. It must have dialog function. Like this function.
;2. Remove WS_VISIBLE and DS_SETFOREGROUND styles. You can do it in Dialog Editor.
;3. It must be modeless. Use flag 1 with ShowDialog.
;4. The macro must not exit immediately. It should wait until the dialog is closed.
;5. The thread must process messages while waiting. opt waitmsg 1.
;6. If need dialog variables, on IDOK call DT_GetControls.
;7. If need to know whether OK pressed, on IDOK set a variable.
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str e3
int OK
hDlg=ShowDialog("dlg_hidden" &dlg_hidden &controls 0 1 0 0 &OK)
opt waitmsg 1
wait 0 -WC hDlg
if(!OK) ret
out e3
;BEGIN DIALOG
;0 "" 0x80C808C8 0x0 0 0 223 135 "Dialog"
;3 Edit 0x54030080 0x200 6 6 96 14 ""
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030300 "*" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,SetTimer hDlg 1 3000 0 ;;show itself after 3s
,
,case WM_TIMER
,sel wParam
,,case 1
,,KillTimer hDlg wParam
,,hid- hDlg
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,DT_GetControls hDlg
,int& rOK=+DT_GetParam(hDlg); rOK=1
,case IDCANCEL
ret 1
Posts: 1,006
Threads: 330
Joined: Mar 2007
Quote:;Note: This is for QM < 2.3.3. In QM 2.3.3 an later, simply use flag 128 with ShowDialog.
I am trying to use the 128 flag for ShowDialog and came across reference to 2.3.3. I am using 2.3.2.8. I can't find any links to 2.3.3.
Is this available?
Thanks,
Stuart
Posts: 858
Threads: 196
Joined: Apr 2005