Posts: 726
Threads: 99
Joined: Mar 2018
I want to add an icon in the upper right corner of the window title bar. Please see the image below. When I click on it, the pop-up menu, I did not find the answer in the forum, I hope someone can provide some suggestions, thank you very much.
Function
Function1
str md=
;BEGIN MENU
;>&File
;,&Open :501 0x0 0x0 Co
;,&Save :502 0x0 0x0 Cs
;,>Submenu
;,,Item1 :551
;,,Item2 :552
;,,<
;,-
;,E&xit :2
;,<
;>&Edit
;,Cu&t :601
;,&Copy :602
;,&Paste :603
;,<
;>&Help
;,&About :901
;,<
;END MENU
;;menu bar example:
;;popup menu example:
;int i=ShowMenu(md); out i
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0 "*" "" "" ""
;if(!ShowDialog(dd &sub.DlgProc 0)) ret
if ( ! ShowDialog ( dd & sub.DlgProc 0 0 0 0 0 0 0 0 0 md)) ret
#sub DlgProc
function # hDlg message wParam lParam
sel message
, case WM_INITDIALOG
, case WM_DESTROY
, case WM_COMMAND goto messages2
ret
;messages2
sel wParam
, case IDOK
, case IDCANCEL
ret 1
Attached Files
Image(s)
Posts: 1,337
Threads: 61
Joined: Jul 2006
03-25-2019, 11:42 PM
(This post was last modified: 03-25-2019, 11:48 PM by Kevin .)
in dialog editor click dialog titlebar and click style button
then select WS_EX_CONTEXTHELP click ok on styles window then click save on dialog editor window
then add the following code below
case WM_COMMAND goto messages2
, case WM_SYSCOMMAND
, sel wParam& 0xfff0
,, case SC_CONTEXTHELP
,, mes "help"
,, ret 1
full code using your posted example
str md=
;BEGIN MENU
;>&File
;,&Open :501 0x0 0x0 Co
;,&Save :502 0x0 0x0 Cs
;,>Submenu
;,,Item1 :551
;,,Item2 :552
;,,<
;,-
;,E&xit :2
;,<
;>&Edit
;,Cu&t :601
;,&Copy :602
;,&Paste :603
;,<
;>&Help
;,&About :901
;,<
;END MENU
;;menu bar example:
;;popup menu example:
;int i=ShowMenu(md); out i
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x400 0 0 224 136 "Dialog" "4"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""
;if(!ShowDialog(dd &sub.DlgProc 0)) ret
if ( ! ShowDialog ( dd & sub.DlgProc 0 0 0 0 0 0 0 0 0 md)) ret
#sub DlgProc
function # hDlg message wParam lParam
sel message
, case WM_INITDIALOG
, case WM_DESTROY
, case WM_COMMAND goto messages2
, case WM_SYSCOMMAND
, sel wParam& 0xfff0
,, case SC_CONTEXTHELP
,, mes "help"
,, ret 1
ret
;messages2
sel wParam
, case IDOK
, case IDCANCEL
ret 1
see link below to topic
dlg_context_help
Posts: 726
Threads: 99
Joined: Mar 2018
03-26-2019, 12:16 AM
(This post was last modified: 03-26-2019, 12:23 AM by win .)
Thank you very much for your help, QM is too powerful, omnipotent
I have maximized, minimized button display, the help button disappears, can the help button be displayed on the left side of the minimize button?
Macro
Macro7
str md=
;BEGIN MENU
;>&File
;,&Open :501 0x0 0x0 Co
;,&Save :502 0x0 0x0 Cs
;,>Submenu
;,,Item1 :551
;,,Item2 :552
;,,<
;,-
;,E&xit :2
;,<
;>&Edit
;,Cu&t :601
;,&Copy :602
;,&Paste :603
;,<
;>&Help
;,&About :901
;,<
;END MENU
;;menu bar example:
;;popup menu example:
;int i=ShowMenu(md); out i
str dd=
;BEGIN DIALOG
;0 "" 0x90CA0AC8 0x400 0 0 224 136 "Dialog" "4"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""
;if(!ShowDialog(dd &sub.DlgProc 0)) ret
if ( ! ShowDialog ( dd & sub.DlgProc 0 0 0 0 0 0 0 0 0 md)) ret
#sub DlgProc
function # hDlg message wParam lParam
sel message
, case WM_INITDIALOG
, case WM_DESTROY
, case WM_COMMAND goto messages2
, case WM_SYSCOMMAND
, sel wParam& 0xfff0
,, case SC_CONTEXTHELP
,, ;mes "help"
,, int i= ShowMenu ( md); out i
,, ret 1
ret
;messages2
sel wParam
, case IDOK
, case IDCANCEL
ret 1
Posts: 1,337
Threads: 61
Joined: Jul 2006
no cannot use context help with minimize and maximize
Attached Files
Image(s)
Posts: 726
Threads: 99
Joined: Mar 2018
I added a pop-up menu that minimizes the size and maximizes functionality, but I can't minimize it to the bottom right corner of the taskbar.
Macro
Macro7
str + md=
;BEGIN MENU
;>&File
;,&Open :501 0x0 0x0 Co
;,&Save :502 0x0 0x0 Cs
;,>Submenu
;,,Item1 :551
;,,Item2 :552
;,,<
;,-
;,E&xit :2
;,<
;>&Edit
;,Cu&t :601
;,&Copy :602
;,&Paste :603
;,<
;&Min :901
;&Min to TrayIcon :902
;&Max :903
;END MENU
;;menu bar example:
;;popup menu example:
;int i=ShowMenu(md); out i
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x400 0 0 224 136 "Dialog" "4"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""
;if(!ShowDialog(dd &sub.DlgProc 0)) ret
if ( ! ShowDialog ( dd & sub.DlgProc 0 0 0 0 0 0 0 0 0 md)) ret
#sub DlgProc
function # hDlg message wParam lParam
sel message
, case WM_INITDIALOG
, case WM_DESTROY
, case WM_COMMAND goto messages2
, case WM_SYSCOMMAND
, sel wParam& 0xfff0
,, case SC_CONTEXTHELP
,, int i= ShowMenu ( md); out i
,, sel i
,,, case 901
,,, min hDlg
,,, case 902
,,, ;;AddTrayIcon
,,, case 903
,,, max hDlg
,, ret 1
ret
;messages2
sel wParam
, case IDOK
, case IDCANCEL
ret 1
Attached Files
Image(s)
Posts: 12,092
Threads: 142
Joined: Dec 2002
03-26-2019, 07:00 PM
(This post was last modified: 03-26-2019, 07:04 PM by Gintaras .)
Macro
Macro338
str md=
;BEGIN MENU
;>&File
;,&Open :501 0x0 0x0 Co
;,&Save :502 0x0 0x0 Cs
;,>Submenu
;,,Item1 :551
;,,Item2 :552
;,,<
;,-
;,E&xit :2
;,<
;>&Edit
;,Cu&t :601
;,&Copy :602
;,&Paste :603
;,<
;&Min :901
;&Min to TrayIcon :902
;&Max :903
;END MENU
;;menu bar example:
;;popup menu example:
;int i=ShowMenu(md); out i
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x400 0 0 224 136 "Dialog" "4"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040801 "*" "" "" ""
Tray tray
;if(!ShowDialog(dd &sub.DlgProc 0)) ret
if ( ! ShowDialog ( dd & sub.DlgProc 0 0 0 0 0 0 0 0 0 md)) ret
#sub DlgProc v
function # hDlg message wParam lParam
sel message
, case WM_INITDIALOG
, case WM_DESTROY
, case WM_COMMAND goto messages2
, case WM_SYSCOMMAND
, sel wParam& 0xfff0
,, case SC_CONTEXTHELP
,, int i= ShowMenu ( md); out i
,, sel i
,,, case 901
,,, min hDlg
,,, case 902
,,, hid hDlg
,,, tray.AddIcon ( "" "tooltip" 1 hDlg)
,,, case 903
,,, max hDlg
,, ret 1
, case WM_USER + 101 ;;from tray icon
, sel lParam
,, case WM_LBUTTONUP
,, tray.Delete
,, act hDlg
ret
;messages2
sel wParam
, case IDOK
, case IDCANCEL
ret 1
Posts: 726
Threads: 99
Joined: Mar 2018