Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Add menu item icons from bitmaps? Collapse All
Subject Author Date
Ed Nafziger Dec 8, 2009 - 5:22 PM

I am trying to add menu item icons from bitmap resources.

I have the following code in a function being called from CMainFrame::OnCreate, but no images are displayed in the menu.

[code]
CExtBitmap bmp;
if( bmp.LoadBMP_Resource( MAKEINTRESOURCE( nBitmapID ) ) )
{
bool result = g_CmdManager->CmdSetIcon(
g_CmdManager->ProfileNameFromWnd( GetSafeHwnd() ),
nCmd,
bmp
);
}
[/code]

nCmd is the menu command ID
nBitmapID is the bitmap resource ID

Ed Nafziger Dec 11, 2009 - 7:38 PM

Thank you for your prompt reply.
I had forgot my overload of OnDrawPopupMenuItem was set to not paint icons.

Technical Support Dec 9, 2009 - 1:30 PM

First of all, please check the command identifier is correct.
Second, if your project have some toolbar resource which contains an icon for the same command identifier, then the code snippet in your message should be invoked after the code which loads the toolbar resource.
Third, if your project uses customizable toolbar and menus, then you should reset the toolbars and menus containing the command which you assigned the bitmap icon. Or you can simply remove the registry state data for your app.