Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Menu/Toolbar dlg in exe
#14
Macro Macro362
Code:
Copy      Help
CloseWindowsOf("DlgMenu" "#32770");err
int w
run "$system$\notepad.exe" "" "" "" 0x1800 win("Notepad" "Notepad") w

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

str dd=
;BEGIN DIALOG
;0 "" 0x80000840 0x90 0 0 385 11 "DlgMenu"
;END DIALOG
;DIALOG EDITOR: "" 0x2030502 "*" "" "" ""

if(!ShowDialog(dd &sub.DlgProc 0 0 128 0 0 0 0 0 0 md)) ret

#sub DlgProc v
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,__GdiHandle-- hb=CreateSolidBrush(0xff00)
,Transparent hDlg 255 0xff00
,SetWindowLong hDlg GWL_HWNDPARENT w
,SetTimer hDlg 1 100 0
,;SendMessage hDlg WM_COMMAND 5 0 ;;execute gButton code. Or use function instead.
,SendMessage hDlg WM_TIMER 1 0 ;;execute gTimer code. Or use function instead.
,hid- hDlg
,case WM_TIMER
,sel wParam
,,case 1 goto gTimer
,case WM_DESTROY
,case WM_CTLCOLORDLG ret hb
,case WM_COMMAND goto messages2
,
ret
;messages2
sel wParam
,case 501
,out "Open"
,case IDCANCEL
,out "Exit"
act w; err
ret 1

;gTimer
Zorder hDlg HWND_TOP SWP_NOACTIVATE
int x_NotePad y_NotePad cx_NotePad cy_NotePad;
if !IsWindow(w)
,CloseWindowsOf("DlgMenu" "#32770");err
,ret
GetWinXY w x_NotePad y_NotePad cx_NotePad cy_NotePad
int x_Dlg y_Dlg cx_Dlg cy_Dlg
GetWinXY hDlg x_Dlg y_Dlg cx_Dlg cy_Dlg
MoveWindow hDlg x_NotePad+150 y_NotePad+3 cx_NotePad-300 cy_Dlg  1;;need to leave enough room for max/min/close app dlg frame buttons and enough of frame to grab for moving/resizing

The last line sets dialog position relative to the window.


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)