Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to redraw menu in a dialog

Posted on 2008-10-01
5
Medium Priority
?
1,657 Views
Last Modified: 2013-11-20
Hi,
I have a dialog that contains a menu.
In a certain point I am disable all menu items and then, enable the menuitems back.
For some reason, the menu doesn't repaint and if I disable the menuitems, they don't look gray. Only after I will move the cursor on top the menuitems, they will redraw.

the following link was supposed to fix my problem but it doesn't :
http://support.microsoft.com/kb/242577


Attached, is a sample project that contains a menu in dialog with the code suggested by the link above.

 added a timer that change to menu enable status every 1 sec.
What I want is that the disable will look gray without the need to move the cursor on top the menu in order to make it redraw

I added .txt to all files so I can zip it and add it as attachment here.

Thanks,
Udi Raz
MenuInDialog.zip
0
Comment
Question by:UdiRaz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 17

Expert Comment

by:CSecurity
ID: 22619990
call UpdateWindow() function. may solve your problem...
0
 
LVL 13

Expert Comment

by:Mark_FreeSoftware
ID: 22620317
you might want to look into the function InvalidateRect,
basically this function tells a window it needs to redraw
http://msdn.microsoft.com/en-us/library/ms534893(VS.85).aspx
0
 

Author Comment

by:UdiRaz
ID: 22621601
C Security : UpdateWindow() didn't help
Mark :
      CRect rect;
      GetWindowRect( rect );
      InvalidateRect( rect );

Didn't work either.

please check the sample project I attached
0
 
LVL 19

Accepted Solution

by:
alb66 earned 2000 total points
ID: 22621789
Try to call DrawMenuBar().
I cannot try your code since I have an older version of visual studio...
0
 

Author Closing Comment

by:UdiRaz
ID: 31501961
Simple and beautiful. Thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question