Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialogue self-destroy
#1
I would appreciate any advice regarding the best way to close a dialogue (self-destroy it) when an external condition is met.

In the example which it follows, the dialogue is closed, by its window it is still displayed, until I move the mouse over it.

Many thanks in advance.

Function GCTw_Dlg2
Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam

if(hDlg)
;,External condition to be tested    
,goto messages

;BEGIN DIALOG
;0 "" 0x90000A40 0x80 0 0 116 15 "Form"
;3 Static 0x54800201 0x0 26 0 49 14 "Time Set"
;4 Button 0x54030300 0x0 0 0 22 14 "Res"
;5 Static 0x54000201 0x204 78 0 36 14 "dt"
;END DIALOG
;DIALOG EDITOR: "" 0x2040307 "" "" "" ""

ret
;messages

sel message
,case WM_INITDIALOG
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
,case WM_CTLCOLORSTATIC

ret
;messages2
sel wParam
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
,case [4]
,out "4"
,
ret 1
#2
Could you give an example how to run your example?
#3
Thank you very much for your interest regarding my inquiry. The actual process of events is as it follows :

GCTw_StTrig2 is triggered by a window and runs toolbar GCTweet_ToolB2, which it hooks GCTwHookProc2. The latter launches GCTw_Dlg2.

Best personal regards.

Function GCTw_StTrig2
Trigger !n"a" "b" /CHROME     Help - how to add the trigger to the macro
Code:
Copy      Help
int hwnd=TriggerWindow
int hwl=mac("GCTweet_ToolB2" hwnd)

Toolbar GCTweet_ToolB2
Code:
Copy      Help
;/hook GCTwHookProc2

Function GCTwHookProc2
Code:
Copy      Help
;/
function# hWnd message wParam lParam

sel message
,case WM_INITDIALOG
,hid id(9999 hWnd)
,if(!ShowDialog("GCTw_Dlg2" &GCTw_Dlg2 0 hWnd 1 WS_CHILD WS_POPUP|WS_CAPTION|WS_SYSMENU 0 0 4)) ret
,case WM_DESTROY
;,x._delete ;;(141027112533
#4
Thanks for posting your macros/functions. I thought it's a simple app but it turn out to be more complicated than I thought.
I'm new with toolbar so I still struggle to figure out how hook your dialog to it.
#5
In any way I do thank you for your willingness to help. Actually, I have already found a rather good solution to my problem : GCTw_Dlg2 launches a function (new thread), under case WM_INITDIALOG, which it performs the control and when satisfied it closes GCTweet_ToolB2 and exits.

Best regards
#6
Macro Macro2821
Code:
Copy      Help
,case WM_INITDIALOG
,SetTimer hDlg 1 100 0
,case WM_TIMER
,sel wParam
,,case 1
,,if condition
,,,KillTimer hDlg 1
,,,clo hDlg
,,,
#7
Gintaras it is genius! Many thanks.


Forum Jump:


Users browsing this thread: 1 Guest(s)