Solved

How to redraw menu in a dialog

Posted on 2008-10-01
5
1,589 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
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 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C++ error cannot convert from std::string to const char * 6 298
FMX TCameraComponent Problem 2 92
JQuery serialize and unserialize 8 180
Why isn't object file created? 6 86
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

685 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