Thread: VC++ 6 Menu resource question

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    60

    VC++ 6 Menu resource question

    When clicking the Menuitem "New" on my IDE, I can choose to create a new Resource File or a new Resource Script.
    I have heard one can create Menu Resources this way, and the name of the resource can be used in a codeline like:

    WNDCLASSEX wcl;
    wcl.lpszMenuName="resourcename";

    Here is my problem:
    When creating a window of the window class above, I can't see the Menu Resource I built with the resource-editor. Will I have to call a function like ShowMenu or so in case WM_CREATE or WM_PAINT? Maybe I made an error with the Menu Resource creation ? Please help me (maybe with code).

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    If you gave your menu resource a string identifier then you can associate it with your window class exactly as you have done ie
    by setting the lpszMenuName of the WNDCLASSEX struct. If you have given your menu resource a (short) int identifier then you need to use something like MAKEINTRESOURCE on it in order to convert it to a form recognisable to that parameter of WNDLASSEX.

    You don't need any additional code; any window created from that registered window class should have the menu attached to it as specified when the window class was registered.

    More information on menus can be found on msdn.

    >>Maybe I made an error with the Menu Resource creation<<

    Maybe, but without seeing it, it's impossible to say. Does your code compile and run ok? Does it report any errors/warnings? If you do get any errors/warnings, post them along with any guilty lines of code. If your project isn't too big, strip out all exe and temp files, zip it up and attach it - it may be easier to spot problems.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Resource question
    By rakan in forum Windows Programming
    Replies: 1
    Last Post: 01-11-2007, 01:01 PM
  2. Simple Menu Questions
    By Olidivera in forum Windows Programming
    Replies: 4
    Last Post: 06-03-2006, 05:29 PM
  3. A tiny question about menu
    By Kelvin in forum Windows Programming
    Replies: 1
    Last Post: 08-05-2002, 03:53 PM
  4. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 10:52 AM
  5. quick question about C Dos text menu pgm i was doing
    By Shadow in forum C Programming
    Replies: 2
    Last Post: 09-16-2001, 10:26 AM