Thread: Resources / MAKEINTRESOURCE

  1. #1

    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
    I'll try it

  4. #4
    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, 07:29 PM
  2. measuring system resources used by a function
    By Aran in forum C Programming
    Replies: 1
    Last Post: 03-13-2006, 04:35 PM
  3. Storing resources into a single file
    By LuckY in forum Game Programming
    Replies: 20
    Last Post: 08-14-2004, 11:28 PM
  4. GlobalMemoryStatus to get "system resources free&
    By hanhao in forum Windows Programming
    Replies: 0
    Last Post: 03-20-2004, 01:30 AM
  5. Adding resources
    By nima_ranjbar in forum Windows Programming
    Replies: 0
    Last Post: 04-14-2002, 11:36 PM