Click here to Skip to main content
15,891,951 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralOpen image file for processing; Pin
Bo Hunter17-Jan-04 13:47
Bo Hunter17-Jan-04 13:47 
GeneralRe: Open image file for processing; Pin
Alexander M.,18-Jan-04 8:32
Alexander M.,18-Jan-04 8:32 
Generalclose awareness Pin
Nemok17-Jan-04 11:30
Nemok17-Jan-04 11:30 
GeneralRe: close awareness Pin
фил21-Jan-04 4:55
фил21-Jan-04 4:55 
GeneralControlling Serial port directly Pin
Mrunal_VIIT17-Jan-04 11:00
Mrunal_VIIT17-Jan-04 11:00 
GeneralRe: Controlling Serial port directly Pin
zecodela17-Jan-04 20:57
zecodela17-Jan-04 20:57 
GeneralRe: Controlling Serial port directly Pin
Mrunal_VIIT18-Jan-04 8:47
Mrunal_VIIT18-Jan-04 8:47 
GeneralGet the menuitem which was pressed Pin
Wim Jans17-Jan-04 10:58
Wim Jans17-Jan-04 10:58 
Hello all,

I'm having difficulties to get the string of a menu item pressed.
What I'm doing is writing a IE toolbar and in one of the pull down menu's I dynamically add popup menu's which are also dynamically filled.

Just for a theoretical example let's say I have a button 'drives' on the toolbar. Pressing the pulldown menu will add some menu entries (the same amount of disk on my system, C; D; E; ...).
Every menu item is a popup itself, and a dynamically created Popupmenu is attached - containing the root level directories for the selected drive (temp, program files, winnt, ...).

Following is an adapted piece of code, but it works how it suppose to

	<br />
MENUITEMINFO mmi;<br />
mmi.cbSize=sizeof(MENUITEMINFO);<br />
mmi.fMask=MIIM_STRING | MIIM_DATA | MIIM_SUBMENU;<br />
<br />
char fn[50];<br />
<br />
// 3 drives in the example<br />
for (int i=0; i<3; i++)<br />
{<br />
    HMENU hMenuToInsert;<br />
    hMenuToInsert = CreatePopupMenu();<br />
    {<br />
	char drv[255];<br />
	while (getthedrives)<br />
	{<br />
	  sprintf( drv, "%s", a_directory);<br />
	  AppendMenu(hMenuToInsert, MF_ENABLED|MF_STRING, ID_DUMMY, drv);<br />
	}<br />
    }<br />
    sprintf( fn, "Drive %s", drvletter);<br />
    mmi.hSubMenu = hMenuToInsert;<br />
    mmi.dwTypeData = fn;<br />
    mmi.fType=MFT_STRING;<br />
    //insert the drives <br />
    InsertMenuItem(m_hDriveMenu, 2+i, TRUE, &mmi);<br />
<br />
}<br />


The problem I'm having is, is that I'm using a dummy ID (ID_DUMMY).
When my ON_COMMAND fires, I have no way to get the correct menu item using GetMenuItemInfo because
a) I'm using the same id for every popup menuitem inserted
b) I'm reusing the HMENU (hMenuToInsert) for my popmenu's

Does anyone know of a simple way to get the text of the menu (directorys on a drive in my case) pressed?

Thanks

Wim
GeneralRe: Get the menuitem which was pressed Pin
Michael Dunn17-Jan-04 14:08
sitebuilderMichael Dunn17-Jan-04 14:08 
GeneralRe: Get the menuitem which was pressed Pin
Wim Jans18-Jan-04 0:25
Wim Jans18-Jan-04 0:25 
GeneralRe: Get the menuitem which was pressed Pin
Michael Dunn18-Jan-04 7:10
sitebuilderMichael Dunn18-Jan-04 7:10 
GeneralRe: Get the menuitem which was pressed Pin
Wim Jans18-Jan-04 8:48
Wim Jans18-Jan-04 8:48 
GeneralRe: Get the menuitem which was pressed Pin
Wim Jans20-Jan-04 8:46
Wim Jans20-Jan-04 8:46 
GeneralSimple Question Pin
BaldwinMartin17-Jan-04 9:10
BaldwinMartin17-Jan-04 9:10 
GeneralRe: Simple Question Pin
Anonymous17-Jan-04 10:59
Anonymous17-Jan-04 10:59 
QuestionGet default proxy (from IE)? Pin
Anonymous17-Jan-04 8:23
Anonymous17-Jan-04 8:23 
AnswerRe: Get default proxy (from IE)? Pin
Joaquín M López Muñoz17-Jan-04 9:30
Joaquín M López Muñoz17-Jan-04 9:30 
GeneralRe: Get default proxy (from IE)? Pin
Anonymous17-Jan-04 9:33
Anonymous17-Jan-04 9:33 
GeneralUCS-2 to UTF-8 and reverse Pin
Dominik Reichl17-Jan-04 8:21
Dominik Reichl17-Jan-04 8:21 
GeneralRe: UCS-2 to UTF-8 and reverse Pin
Jörgen Sigvardsson17-Jan-04 8:47
Jörgen Sigvardsson17-Jan-04 8:47 
GeneralChange MFC Icon Pin
shultas17-Jan-04 7:31
shultas17-Jan-04 7:31 
GeneralRe: Change MFC Icon Pin
l a u r e n17-Jan-04 7:51
l a u r e n17-Jan-04 7:51 
GeneralRe: Change MFC Icon Pin
shultas17-Jan-04 8:47
shultas17-Jan-04 8:47 
GeneralRe: Change MFC Icon Pin
Michael Dunn17-Jan-04 8:49
sitebuilderMichael Dunn17-Jan-04 8:49 
GeneralRe: Change MFC Icon Pin
shultas17-Jan-04 8:55
shultas17-Jan-04 8:55 

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.