Solved

How to redraw menu in a dialog

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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sameEnds challenge 3 160
ShiftLeft challenge 21 82
matchUp  challenge 9 110
firstChar challenge 13 115
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…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

809 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