Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to link dialogue box to menu bar item.

For Ex:I have menu item as Message when i click on that message menu item the concerned dialogue box has to be displayed.

How can I achieve this using VC++ 6.0 MFC Wizard SDI application.
Can any one help me to do this


Thanks u alot
Posted
Updated 21-Jun-11 0:11am
v3

You do not say whether you are using MFC or straight Win32, but in either case you add the code to run the dialog at the point where you capture the command value raised by the menu. For example in Win32 do it in your WndProc function like this:
LRESULT CALLBACK WndProc(HWND		hWnd,
			 UINT		uMessage,
			 WPARAM		wParam,
			 LPARAM		lParam
			 )
{
    switch (uMessage)
    {
	case WM_COMMAND:
            if (wParam == IDM_MENUCOMMAND)
            {
                // show your dialog here
            }

	case WM_DESTROY:
	    PostQuitMessage(0);
            return 0;
	
    }
	
    return DefWindowProc(hWnd, uMessage, wParam, lParam);
}
 
Share this answer
 
in MFC on Menuitem MouseDown event, add code...

Dlg.DoModal(); //Dlg is object of your required DlgBox Class
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900