Resources / MAKEINTRESOURCE

This is a discussion on Resources / MAKEINTRESOURCE within the Windows Programming forums, part of the Platform Specific Boards category; I have made a resource file, built it, and made a menu. I made a include file that has all ...

  1. #1
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552

    Resources / MAKEINTRESOURCE

    I have made a resource file, built it, and made a menu. I made a include file that has all the definitions for the resources. Now I am editing the Window class to put the menu in, and I type in this:
    Code:
    sampleClass.lpszMenuName =  LoadMenu(hinstance, MAKEINTRESOURCE(Menubar));
    The resource file built fine, but when I try to compile my source it says:

    assignment to 'const CHAR *' from 'HMENU__ *'

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    You need to cast the return value from LoadMenu to the type you require to eliminate that error, but that might create problems itself...

    If the 'lpszMenuName' variable of your sampleClass object is intended to be used as the 'lpszMenuName' variable of a WNDCLASSEX/WNDCLASS struct to be used on wnd registration then you do not need to use LoadMenu, simply using 'MAKEINTRESOURCE(Menubar)' directly should be ok, assuming Menubar is a 16bit int resource defined id for your menu.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    I'll try it

  4. #4
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    It works! thx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Resources
    By abraham2119 in forum C Programming
    Replies: 5
    Last Post: 04-20-2009, 08:29 PM
  2. measuring system resources used by a function
    By Aran in forum C Programming
    Replies: 1
    Last Post: 03-13-2006, 05:35 PM
  3. Storing resources into a single file
    By LuckY in forum Game Programming
    Replies: 20
    Last Post: 08-15-2004, 12:28 AM
  4. GlobalMemoryStatus to get "system resources free&
    By hanhao in forum Windows Programming
    Replies: 0
    Last Post: 03-20-2004, 02:30 AM
  5. Adding resources
    By nima_ranjbar in forum Windows Programming
    Replies: 0
    Last Post: 04-15-2002, 12:36 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21