Click here to Skip to main content
15,922,166 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
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 
Ok,

I see it now. One thing what I discovered when playing with the WM_MENUSELECT was that I couldn't get the (a random) text from my popup menu (just for a test, take the first entry of the popupmenu, I will move it to the WM_COMMAND later).

What I did was this:

<br />
LRESULT CMyToolBar::OnMenuSelect(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)<br />
{<br />
	if (lParam&&(HIWORD(wParam)&MF_POPUP))<br />
	{<br />
		HMENU hSubMenu = GetSubMenu ( (HMENU)lParam, LOWORD(wParam));<br />
<br />
		MENUITEMINFO mii;<br />
		mii.fMask = MIIM_STRING;<br />
<br />
		char c[2000];<br />
		mii.dwTypeData=c;<br />
		mii.cch=2000;<br />
<br />
		GetMenuItemInfo(hSubMenu, 0, TRUE, &mii);<br />
		MessageBox(mii.dwTypeData);<br />
	}<br />
	return 0;<br />
}<br />


According to the documentation, lParam contains the Handle to the menu I pressed (the main menu), and if HIWORD(wParam) contains flag MF_POPUP, the LOWORD(wParam) contains the the position pressed in the menu.

If I use GetSubMenu((HMENU)lParam, HIWORD(wParam)), I should get the handle to my popupmenu containing the directories, right?
I outputted the parameters, and the handle and index looked OK.

But when I used GetMenuItemInfo using the handle obtained with GetSubMenu and index 0 (the first Item in the popup menu), it returns an empty string.

Any idea what I'm doing wrong?

Thanks

Wim
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 
GeneralRe: Change MFC Icon Pin
l a u r e n17-Jan-04 8:58
l a u r e n17-Jan-04 8:58 
GeneralRe: Change MFC Icon -- THANKS! Pin
shultas17-Jan-04 9:14
shultas17-Jan-04 9:14 
GeneralUse the Radio button to control motor speed Pin
Member 64882817-Jan-04 6:44
Member 64882817-Jan-04 6:44 
GeneralRe: Use the Radio button to control motor speed Pin
l a u r e n17-Jan-04 7:52
l a u r e n17-Jan-04 7:52 

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.