Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I've been trying to do this for like 45 Mins. now (Dialog)
#1
Ok, I know this is very easy. But I canno't seem to figure it out, I've got most of it done. Just one simple mistake most likely. If anyone could help , I would appreciate it. Here is the code:

Code:
Copy      Help
function# hDlg message wParam lParam
if(hDlg) goto messages
str a=".exe"
str b="YahooMessenger"
str sf=
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 221 133 "Yahoo! Messenger"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Button 0x54032000 0x0 120 83 98 29 "Close Yahoo Messenger"
;5 Static 0x54000010 0x20000 116 113 117 1 ""
;4 Button 0x54020007 0x0 116 75 108 100 ""
;END DIALOG

str controls="3"
str e3
if(!ShowDialog(sf 0 &controls 0 2)) ret
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 3
,ShutDownProcess a.from(b) 2
,case IDOK
,case IDCANCEL
ret 1

The problem is, that I can't get the "Close Yahoo! Messenger" button to actually close Yahoo when I press it. I don't know what I'm doing wrong.
#2
Dialog function is called many times while the dialog is shown. Each time, local variables are created and destroyed. Make sure you assign values to local variables before using them. Or use thread variables (str-) instead.
#3
You could also just simply make a push button.
This way all you do is click the button and then hit OK.

EXAMPLE:
Here I'm using Quick Macros as the program to shutdown for this example.

Dialog Trigger:
Code:
Copy      Help
str controls = "6"
str c6Clo
str a=".exe"
str b="qm"
if(!ShowDialog("Dialog2" &Dialog2 &controls)) ret
if(c6Clo=1)
,ShutDownProcess a.from(b) 2


Dialog2:
Code:
Copy      Help
;\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Form"
;1 Button 0x54030001 0x4 66 108 48 14 "OK"
;2 Button 0x54030000 0x4 124 108 48 14 "Cancel"
;6 Button 0x54013003 0x0 64 72 106 20 "Close Yahoo Messenger"
;4 Button 0x54020007 0x0 52 100 132 26 ""
;3 Button 0x54020007 0x0 52 62 132 38 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2010808 "" ""


ret

;messages
if(message=WM_INITDIALOG) DT_Init(hDlg lParam)
;int param=DT_GetParam(hDlg)

sel message
,case WM_INITDIALOG
,ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1
Taking on Quick Macros one day at a time


Forum Jump:


Users browsing this thread: 1 Guest(s)