much simpler way add a tray icon. With a dialog can useĀ
case WM_USER+101 for the tray icon actions
no need to make exe and no subfunctions
also includes simple autosize controls example
Function DialogExample
case WM_USER+101 for the tray icon actions
no need to make exe and no subfunctions
also includes simple autosize controls example
Function DialogExample
str dd=
;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 224 136 "Dialog"
;4 Edit 0x54231044 0x200 8 24 198 84 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040800 "*" "" "" ""
str controls = "4"
str e4
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc
function# hDlg message wParam lParam
Tray-- t_ti
sel message
,case WM_INITDIALOG
,t_ti.AddIcon("$qm$\dialog.ico" "this is the tray icon tooltip" 1 hDlg)
,DT_SetAutoSizeControls(hDlg "1m 2m 4s")
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_USER+101
,sel lParam
,,case WM_LBUTTONUP ;;on left click tray icon
,,act hDlg;;Show dialog
,,case WM_RBUTTONUP ;;on right click tray icon
,,;;the if else code block below will vary the tray icon right click menu depending on if dialog is visable or not
,,if !IsWindowVisible(hDlg)
,,,sel ShowMenu("1 Show[]2 Exit" hDlg)
,,,,case 1 act hDlg;;Show dialog
,,,,case 2 DT_EndDialog hDlg;;;;Close dialog
,,else
,,,sel ShowMenu("1 Hide[]2 Exit" hDlg)
,,,,case 1 hid hDlg;;Hide dialog
,,,,case 2 DT_EndDialog hDlg;;;;Close dialog
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1