Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CheckMenuItem( ) not working!!

308 views
Skip to first unread message

Colin Reinhardt

unread,
Oct 6, 1999, 3:00:00 AM10/6/99
to
Some days just aren't my day....

I load my menu and try to check it, but nothing happens--no checky:

cMenu.LoadMenu( IDR_MENU1 );
cMenu.CheckMenuItem( ID_ENABLE_AGENT, MF_BYCOMMAND | MF_CHECKED );

If I retrieve the menu string for the same menu ID, I get the correct text
for the menu item I'm trying to check...

cMenu.GetMenuString( ID_ENABLE_AGENT, cstrMenuText, MF_BYCOMMAND );

What the *&^(*@# is wrong here?

You're my hero if you can tell me what's wrong. Thanks,

-Colin Reinhardt

Colin Reinhardt

unread,
Oct 6, 1999, 3:00:00 AM10/6/99
to
Still working on this one folks... :-(

In between LoadMenu and CheckMenuItem, I am calling
SetMenuItemBitmaps( ID_ENABLE_AGENT, MF_BYCOMMAND, NULL, NULL );
this returns TRUE (success).

but still no checkmarks showing up.

If I call GetMenuState, it reflects the correct state, checked or unchecked.
But no checkmark bitmap on the visible menu.
I even tried calling UpdateWindow( ) in the OnUpdateEnableAgent( ) method...

Help?!?


Colin Reinhardt wrote in message ...

CENK CIVICI

unread,
Oct 7, 1999, 3:00:00 AM10/7/99
to
Top level menu items can not be checked. Is there such possibility. Can you
give more information about the type of the menu popup etc and the type of
the menu item
Colin Reinhardt <coli...@oz.net> wrote in message
news:rvnhju...@corp.supernews.com...

Colin Reinhardt

unread,
Oct 7, 1999, 3:00:00 AM10/7/99
to
This is a second level menu item underneath a top level popup menu.
I currently have an open issue with Microsoft regarding this. THeir MFC
techician was able to reproduce the problem, but does not currently know
what is wrong...

What I am doing is loading the menu and then checking it as described in the
code below. I also call the SetMenuItemBitmaps() function as described in
the addendum message.
I can receive the text string of the menu item correctly, so I know I've got
the right menu item.
I can also call GetMenuState and it will reflect the correct state, either
MF_CHECKED or MF_UNCHECKED,
so the state is actually changing. However, the checkmark bitmap does not
display.
You can repro this problem simply with a basic AppWizard generated Dialog
application.
I am now going to try creating a custom bitmap graphic and see if that
works.
Has anyone else encountered this problem (feature ;-) )...?
THank you,


CENK CIVICI wrote in message ...

Bob Moore

unread,
Oct 7, 1999, 3:00:00 AM10/7/99
to
On Wed, 6 Oct 1999 14:36:04 -0700, Colin Reinhardt wrote:

> cMenu.LoadMenu( IDR_MENU1 );
> cMenu.CheckMenuItem( ID_ENABLE_AGENT, MF_BYCOMMAND | MF_CHECKED );

I'm curious about this call to LoadMenu, and where cMenu came from.
Have you used SetMenu to attach the menu to the window ?

--
Bob Moore [MVP]
http://www.mooremvp.freeserve.co.uk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Due to an unreasonable amount of queries, I no
longer answer unsolicited email questions. Sorry,
no exceptions, and yes, this DOES mean you.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Joseph M. Newcomer

unread,
Oct 9, 1999, 3:00:00 AM10/9/99
to
Have you perhaps confused LoadMenu (which loads a new copy of the menu
from a resource file) with GetMenu (which gives you access to the
current top-level menu for a window)?
joe

On Wed, 6 Oct 1999 14:36:04 -0700, "Colin Reinhardt" <coli...@oz.net>
wrote:

>Some days just aren't my day....
>
>I load my menu and try to check it, but nothing happens--no checky:
>

> cMenu.LoadMenu( IDR_MENU1 );
> cMenu.CheckMenuItem( ID_ENABLE_AGENT, MF_BYCOMMAND | MF_CHECKED );
>

>If I retrieve the menu string for the same menu ID, I get the correct text
>for the menu item I'm trying to check...
>
> cMenu.GetMenuString( ID_ENABLE_AGENT, cstrMenuText, MF_BYCOMMAND );
>
>What the *&^(*@# is wrong here?
>
>You're my hero if you can tell me what's wrong. Thanks,
>
>-Colin Reinhardt
>

Joseph M. Newcomer
email: newc...@flounder.com
Web: www3.pgh.net/~newcomer
MVP Tips: www3.pgh.net/~newcomer/mvp_tips.htm
Author of "Win32 Programming" (with Brent Rector, Addison-Wesley, 1997)
Author of "Developing Windows NT Device Drivers" (with Ed Dekker, AWL, 1999)

0 new messages