Click here to Skip to main content
15,900,643 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generaltype cast Pin
sinacetiner27-Aug-04 1:28
sinacetiner27-Aug-04 1:28 
Generalloading a program Pin
Daniel Kanev27-Aug-04 1:04
Daniel Kanev27-Aug-04 1:04 
GeneralRe: loading a program Pin
David Salter27-Aug-04 1:10
David Salter27-Aug-04 1:10 
Generalalignment in grid control Pin
nainakhawaja27-Aug-04 0:15
nainakhawaja27-Aug-04 0:15 
GeneralRe: alignment in grid control Pin
David Crow27-Aug-04 9:34
David Crow27-Aug-04 9:34 
GeneralRe: alignment in grid control Pin
nainakhawaja27-Aug-04 19:22
nainakhawaja27-Aug-04 19:22 
GeneralImprove performance of SOAP over HTTP Pin
lamnd26-Aug-04 22:54
lamnd26-Aug-04 22:54 
GeneralCheckMenuItem() problem Pin
Dan Nicolici26-Aug-04 22:40
Dan Nicolici26-Aug-04 22:40 
Hi! I have a problem checking and unchecking a menu item. The menu itself, is a context menu, activated when the system tray icon is right-clicked. When the user clicks a certain menu item, I want to check/uncheck it and take some action accordingly. I handle the click on the menu item like this:


void CZdnDlg::OnContextmenuStartup()
{
CMenu mmenu;
mmenu.LoadMenu(IDR_CONTEXT_MENU);
CMenu* submenu = mmenu.GetSubMenu(0);

UINT state = submenu->GetMenuState(ID_CONTEXTMENU_STARTUP, MF_BYCOMMAND);
ASSERT(state != 0xFFFFFFFF);

if (state & MF_CHECKED)
{
submenu->CheckMenuItem(ID_CONTEXTMENU_STARTUP, MF_UNCHECKED);
//some action 1...
}
else
{
submenu->CheckMenuItem(ID_CONTEXTMENU_STARTUP, MF_CHECKED);
//some action 2...
}
}


If initially the menu item is checked, then it takes "some action 1...", but it does not uncheck it. If initially the menu item is unchecked, it takes the "some action 2..." and it remains checked.

Why does this happen? Please help me!



danibanez
GeneralRe: CheckMenuItem() problem Pin
Hans Ruck27-Aug-04 0:55
Hans Ruck27-Aug-04 0:55 
GeneralRe: CheckMenuItem() problem Pin
Michael Dunn27-Aug-04 21:06
sitebuilderMichael Dunn27-Aug-04 21:06 
GeneralRe: CheckMenuItem() problem Pin
Dan Nicolici30-Aug-04 1:36
Dan Nicolici30-Aug-04 1:36 
GeneralHelp required Pin
Sreekanth Muralidharan26-Aug-04 22:22
Sreekanth Muralidharan26-Aug-04 22:22 
GeneralRe: Help required Pin
KaЯl27-Aug-04 1:09
KaЯl27-Aug-04 1:09 
GeneralSend a file to my server using MFC Pin
anderslundsgard26-Aug-04 22:19
anderslundsgard26-Aug-04 22:19 
GeneralRe: Send a file to my server using MFC Pin
Rory Solley26-Aug-04 23:12
Rory Solley26-Aug-04 23:12 
GeneralRe: Send a file to my server using MFC Pin
darkbyte27-Aug-04 13:44
darkbyte27-Aug-04 13:44 
GeneralDock Bar like ObjectDock Pin
puresilence_200226-Aug-04 21:33
puresilence_200226-Aug-04 21:33 
GeneralPassing single service in command line Pin
Its due when26-Aug-04 21:29
Its due when26-Aug-04 21:29 
GeneralRe: Passing single service in command line Pin
rotu27-Aug-04 0:51
rotu27-Aug-04 0:51 
GeneralRe: Passing single service in command line Pin
Its due when29-Aug-04 14:21
Its due when29-Aug-04 14:21 
GeneralRe: Passing single service in command line Pin
David Crow27-Aug-04 2:21
David Crow27-Aug-04 2:21 
GeneralRe: Passing single service in command line Pin
Its due when29-Aug-04 14:26
Its due when29-Aug-04 14:26 
GeneralRe: Passing single service in command line Pin
David Crow30-Aug-04 2:34
David Crow30-Aug-04 2:34 
QuestionHow to Share Data between DLL to DLL Pin
Savita Kashyap26-Aug-04 20:13
Savita Kashyap26-Aug-04 20:13 
AnswerRe: How to Share Data between DLL to DLL Pin
jmkhael27-Aug-04 2:38
jmkhael27-Aug-04 2:38 

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.