Skip to main content
GameDev.net gamedev.net
🔒 Locked

Menu Resources and Bitmaps

Started by SouthernMunk Aug 6, 2006 at 3:05 AM 3 replies 750+ views
Original Post
SouthernMunk
SouthernMunk
I'm not sure if it's possible, but in the Windows API, is it possible to add bitmaps to menu resources? For example, a "typical" window resource script might look like:

#include "Resource.h"

IDM_MAIN MENU
{
    POPUP "&File"
    {
        MENUITEM "&New", IDM_FILE_NEW
    }
}


But to include bitmaps, it might look like:

#include "Resource.h"

IDM_MAIN MENU
{
    POPUP "&File"
    {
        MENUITEM "&New", IDM_FILE_NEW, BITMAP new.bmp
    }
}


Is this possible with menu resources, or do you have to use the Windows API menu functions? Thanks a lot. I know I'll get a good answer, and I apologize if this topic has been covered (I haven't found it if it has).
Woooooooot!
Servant of the Lord
Servant of the Lord
MY_IMAGE BITMAP "MyImage.bmp"

MY_ICON ICON "MyIcon.ico"

Icons must be 32 * 32, I believe, and the icon with the lowest #define number in your resource will be placed as the .exe's icon. You still need to define MY_IMAGE/MY_ICON in your resource.h and the images need to be in the correct directory at compile time, or you'll get a build error.

[Edit:] Err, I misunderstood your question, ignore my post. [smile]
SouthernMunk
SouthernMunk
Thanks for that. I was actually referring to having an icon *in the actual menu* if you know what I mean. For example, when you click File->Save, there is a small icon next to the word "Save" of a small floppy disk. Is that clear?

Thanks for you help on the icons though. I didn't realise that the icon with the lowest #define is the default icon for the application! :D
Woooooooot!
Servant of the Lord
Servant of the Lord
No problem. Yeah, come to think of it, I wouldn't mind knowing how to add icons to the menu either. I know how to get the default icons(save, open, exit, etc...), but that's not of use unless I know how to use them corrextly.

Sorry I can't be of more help; I've only been into Win32 for two days now.
yadango
yadango
i'm pretty sure you have to use the API functions like SetMenuItemInfo, as bitmap menus require you to provide actual handles (HBITMAPs) for which the application is responsible for creating and destroying. so u can't specify a bitmap identifier in a menu resource because you're then asking the menu to be responsible to call LoadBitmap and DeleteObject. there is a MENUEX resource, however you'll see if you use the MFT_BITMAP flag with it no matter what you put as the id it won't load your bitmap.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.