Click here to Skip to main content
15,888,527 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMenu with images Pin
Alex Cutovoi21-May-07 2:36
Alex Cutovoi21-May-07 2:36 
AnswerRe: Menu with images Pin
Hans Dietrich21-May-07 3:17
mentorHans Dietrich21-May-07 3:17 
AnswerRe: Menu with images Pin
Hamid_RT21-May-07 6:48
Hamid_RT21-May-07 6:48 
GeneralRe: Menu with images Pin
Alex Cutovoi21-May-07 8:33
Alex Cutovoi21-May-07 8:33 
GeneralRe: Menu with images Pin
Hamid_RT21-May-07 8:36
Hamid_RT21-May-07 8:36 
GeneralRe: Menu with images Pin
Alex Cutovoi22-May-07 2:00
Alex Cutovoi22-May-07 2:00 
GeneralRe: Menu with images Pin
Hamid_RT22-May-07 2:09
Hamid_RT22-May-07 2:09 
AnswerRe: Menu with images Pin
Manoj Kumar Rai21-May-07 19:46
professionalManoj Kumar Rai21-May-07 19:46 
Hi Alex,

Since you have asked specifically for win32, I thought I should let you know the precisely steps to create Menu and answer your questions.

1) I've readed that I need to create owner draw menus. Is that right?
Its not mandatory.
2) How can I load an image to insert in my menu? The size of the image matters or when I insert, windows fit the image according the area that I passed.
Windos fits the image accordingly. If you want text with a bmp as a menu item then again the space will be fixed for the bmp.


Steps:
HMENU Menu;
Menu = CreatePopupMenu();

HBITMAP hBitmap1 = LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP1));
HBITMAP hBitmap2 = LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP2));

//Append
AppendMenu(Menu, MF_STRING, 2000, "Test3333333333");
AppendMenu(Menu, MF_SEPARATOR, NULL, "");
AppendMenu(Menu, MF_STRING, 2001, "Test2");
SetMenuItemBitmaps(Menu, 2001, MF_BYCOMMAND,hBitmap2, hBitmap1);

TrackPopupMenu(Menu,TPM_RIGHTALIGN,point.x, point.y,0,this->m_hWnd,NULL);

The above steps will create 2 Menu items, one only text and other bmp with text.

Manoj
Never Gives up

GeneralRe: Menu with images Pin
Alex Cutovoi22-May-07 2:03
Alex Cutovoi22-May-07 2:03 
QuestionException handling or return value Pin
Raj Prathap21-May-07 2:32
Raj Prathap21-May-07 2:32 
AnswerRe: Exception handling or return value Pin
CPallini21-May-07 3:10
mveCPallini21-May-07 3:10 
GeneralRe: Exception handling or return value Pin
Raj Prathap21-May-07 18:22
Raj Prathap21-May-07 18:22 
GeneralRe: Exception handling or return value Pin
Nelek21-May-07 19:53
protectorNelek21-May-07 19:53 
GeneralRe: Exception handling or return value Pin
CPallini21-May-07 20:46
mveCPallini21-May-07 20:46 
GeneralRe: Exception handling or return value Pin
Raj Prathap21-May-07 23:17
Raj Prathap21-May-07 23:17 
QuestionGroupbox flickering Pin
baerten21-May-07 2:31
baerten21-May-07 2:31 
QuestionHow to insert a binary file into SQL database, via ADO Pin
lilnelse21-May-07 2:15
lilnelse21-May-07 2:15 
QuestionRe: How to insert a binary file into SQL database, via ADO Pin
David Crow21-May-07 3:03
David Crow21-May-07 3:03 
AnswerRe: How to insert a binary file into SQL database, via ADO Pin
lilnelse21-May-07 16:56
lilnelse21-May-07 16:56 
AnswerRe: How to insert a binary file into SQL database, via ADO Pin
lilnelse21-May-07 17:05
lilnelse21-May-07 17:05 
QuestionRead Excel file Pin
Syamlal S Nair21-May-07 2:14
Syamlal S Nair21-May-07 2:14 
AnswerRe: Read Excel file Pin
David Crow21-May-07 3:08
David Crow21-May-07 3:08 
AnswerRe: Read Excel file Pin
Hamid_RT21-May-07 6:54
Hamid_RT21-May-07 6:54 
AnswerRe: Read Excel file Pin
Sameerkumar Namdeo21-May-07 21:07
Sameerkumar Namdeo21-May-07 21:07 
QuestionVC6 to VC8: how to set two libs in the VC8 to be linked with the project? Pin
Joan M21-May-07 2:02
professionalJoan M21-May-07 2:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.