Re: A window with file and help meny items
From: Frank Hickman (fhickman_NOSP_at_M_noblesoft.com)
Date: 12/12/04
- Next message: msg_du: "Use Greta(STL) in MFC."
- Previous message: Tony Johansson: "A window with file and help meny items"
- In reply to: Tony Johansson: "A window with file and help meny items"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 12 Dec 2004 08:26:36 -0500
You need to create a menu resource with the ID IDR_NYMENU then Windows will
attach it when the window is created.
--
============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.
"Tony Johansson" <johansson.andersson@telia.com> wrote in message
news:vAWud.10879$d5.96061@newsb.telia.net...
> Hello Experts!
>
> I have a document about window system and here they show a window with two
> menu items at the top of the screen to choose from. The Items are File and
> Help.
>
> Now to my question I can't understand where in the code, statements are
> used to be able to show the two menu items File and Help?
>
> Here is the program:
> The program is not complete because the callback procedure WndProc are not
> include in the code but that doesn't affect the question.
>
> #include <windows.h>
> #include "resource.h"
>
> int WINAPI WinMain(HINSTANCE hInstance, hPrevInstance, LPSTR lpCmdLine,
> int nCmdShow)
> {
> WNDCLASSEX wc;
> HWND hwnd;
> MSG Msg;
> wc.cbSize = sizeof(WNDCLASSEX);
> wc.style = 0;
> wc.lpfnWndProc = WndProc;
> wc.cbClsExtra = 0;
> wc.cbWndExtra = 0;
> wc.hInstance = hInstance;
> wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
> wc.hCursor = LoadCursor(NULL, IDC_ARROW);
> wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
> wc.lpszMenuName = MAKEINTRESOURCE(IDR_NYMENU);
> wc.lpszClassName = g_szClassName;
> wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
>
> if (!RegisterClassEx(&wc))
> {
> MessageBox(NULL, "Window Registration failed!", "Error!",
> MB_ICONEXCLAMATION | MB_OK);
> return 0;
> }
>
> hwnd = CreateWindowEx( WS_EX_CLIENTEDGE,
> g_szClassName,
> "The title of my
> winow",
> WS_OVERLAPPEDWINDOW,
> CW_USEDEFAULT,
> CW_USEDEFAULT,
> 240,
> 120,
> NULL,
> NULL,
> hInstance,
> NULL);
>
> if (hwnd == NULL)
> {
> MessageBox(NULL, "Window Creation Failed!", "Error!",
> MB_ICONEXCLAMATION | MBOK);
> return 0;
> }
>
> ShowWindow(hwnd);
> UpdateWindow(hwnd);
>
> while(GetMessage(&Msg, NULL, 0 , 0) > 0)
> {
> TranslateMessage(&Msg);
> DispatchMessage(&Msg);
> }
> return Msg.wParam;
> } // End WinMain
>
> Many thanks in advance.
>
> //Tony
>
- Next message: msg_du: "Use Greta(STL) in MFC."
- Previous message: Tony Johansson: "A window with file and help meny items"
- In reply to: Tony Johansson: "A window with file and help meny items"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|