Re: [Dev-C++] Creating menu for windows
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Kevin W. <ke...@me...> - 2001-08-21 23:09:25
|
Hello Ameer,
Try this code in your resource file:
#include <windows.h>
100 MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Open", 101
MENUITEM "&Save", 102
MENUITEM "E&xit", 103
END
END
and in your winmain function:
...
wincl.lpszMenuName = MAKEINTRESOURCE(100); /* Menu ID 100 */
...
and the window procedure:
LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam,
LPARAM lParam)
{
switch (message) /* handle the messages */
{
case WM_DESTROY:
PostQuitMessage(0); /* send a WM_QUIT to the message queue
*/
break;
case WM_COMMAND:
{
switch (wParam)
{
case 101:
MessageBox(hwnd,"File_Open clicked","Not
implemented",MB_OK);
break;
case 102:
MessageBox(hwnd,"File_Save clicked","Not
implemented",MB_OK);
break;
case 103:
PostMessage(hwnd, WM_CLOSE, 0, 0);
break;
}
}
default: /* for messages that we don't deal
with */
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}
That should work!
Kevin.
----- Original Message -----
From: Ameer Khan <pul...@ya...>
To: <dev...@li...>
Cc: <web...@bl...>
Sent: Tuesday, August 21, 2001 4:30 PM
Subject: [Dev-C++] Creating menu for windows
Dear Friend,
I could build the resource file created for creating a menu for the Window
created using Window Application, using DEV-C++ 4. I could edit the resource
file and it is given below.
----------------------------------------------------------------------------
------------
600 MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Open", 601
MENUITEM "&Save", 602
MENUITEM "&Exit", 603
END
POPUP "&Open"
BEGIN
END
POPUP "&Save"
BEGIN
END
POPUP "&Exit"
BEGIN
END
END
0 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "C:/DEV-C++/Icon/MAINICON.ICO"
----------------------------------------------------------------------------
------------I have edited the resources file rsrc.rc for including a menu
item File with three sub items Open,Save and Exit.
When i compiled the project after including this resources file to the
project I am getting error"Out of environment space,Out of environment
space, Id: cannot open -Istdc++:
No such file or directory."
Would you please tell me , in step by step, how to created menus for the
Window Applications, using Dev C++.
Thank u
Ameer Khan
pul...@ya...
|