i write a program,and click a button,popup a dialog,i want append menu to popuped dialog,how to do?
the error follow:


IMAGEDialog DIALOG 10, 10, 205, 250
STYLE 0x0004 | DS_CENTER | WS_CAPTION | WS_MINIMIZEBOX |
WS_SYSMENU | WS_VISIBLE | WS_OVERLAPPED | DS_MODALFRAME | DS_3DLOOK
CAPTION "??????"
FONT 9, "????"


BEGIN
IDM_IMGMENU menu discardable
BEGIN
popup ""
BEGIN
menuitem "M1", IDM_MENU1
menuitem "M2", IDM_MENU2
menuitem "M3", IDM_MENU3
menuitem separator
menuitem "???", IDM_EXIT
END
END
PUSHBUTTON "B", IDC_BTNB, 25,110,15,15
PUSHBUTTON "C", IDC_BTNC, 40,110,15,15
PUSHBUTTON "D", IDC_BTND, 55,110,15,15
END
Posted on 2003-02-04 05:36:14 by bgcq
try the SetMenu function

BOOL SetMenu(
HWND hWnd, // handle to window
HMENU hMenu // handle to menu
);

I consider you have a dlgproc for your dialog...

In fact, generaly, i create dialog through resource file, so here is a piece of code



Invoke LoadMenu(hInstance, IDM_IMGMENU)
mov hMenu, eax

invoke CreateDialogParam,hInstance,IMAGEDialog,0,addr dlgproc,0
mov hWnd, eax
invoke ShowWindow,hWnd,SW_SHOWDEFAULT

invoke SetMenu,hWnd, hMenu
mov result, eax


Posted on 2003-02-04 11:08:56 by DarkEmpire
i insert menu macro to dialog,and remove popup "",it is work now.
Just i tried SetMenu api,and it is work,too.thanks everybody
:>

IMAGEDialog DIALOG 10, 10, 205, 250
STYLE 0x0004 | DS_CENTER | WS_CAPTION | WS_MINIMIZEBOX |
WS_SYSMENU | WS_VISIBLE | WS_OVERLAPPED | DS_MODALFRAME | DS_3DLOOK
CAPTION "??????"
MENU IDM_IMGMENU;THIS INSERTED
FONT 9, "????"
Posted on 2003-02-04 19:12:45 by bgcq