Click here to Skip to main content
15,923,852 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Accelerators not working in MFC dll Pin
Randor 4-Jan-12 7:21
professional Randor 4-Jan-12 7:21 
AnswerRe: Accelerators not working in MFC dll Pin
ncitom4-Jan-12 8:43
ncitom4-Jan-12 8:43 
JokeRe: Accelerators not working in MFC dll Pin
Randor 4-Jan-12 9:02
professional Randor 4-Jan-12 9:02 
GeneralRe: Accelerators not working in MFC dll Pin
ncitom4-Jan-12 12:06
ncitom4-Jan-12 12:06 
QuestionDynamic menu with statusbar messages. Pin
Maximilien3-Jan-12 10:24
Maximilien3-Jan-12 10:24 
AnswerRe: Dynamic menu with statusbar messages. Pin
ThatsAlok3-Jan-12 19:19
ThatsAlok3-Jan-12 19:19 
GeneralRe: Dynamic menu with statusbar messages. Pin
Maximilien4-Jan-12 3:35
Maximilien4-Jan-12 3:35 
AnswerRe: Dynamic menu with statusbar messages. Pin
Randor 4-Jan-12 0:59
professional Randor 4-Jan-12 0:59 
Hey Max,

I invested a couple of minutes into downloading and looking at the Microsoft sample. I am assuming that you are referring to the dynamic menu being built to hold the user favorites. It looks like the author of the code sample used 0xE00 as a magic number for the beginning ID-offset of those dynamic menu items.

You stated in your post that you are already using ON_UPDATE_COMMAND_UI and that it was working for the other menu items. Therefore I would recommend that you use:

ON_UPDATE_COMMAND_UI_RANGE[^]

Since we know that the author of the code sample used the magic number 0xE00 as the starting ID... then you could do something like:

C++
ON_UPDATE_COMMAND_UI_RANGE(0xE00,0xE00 + 0xFF, &CMainFrame::OnUpdateFavorites) //Might want to increase the top number


With this minor change the code sample will fire OnUpdateFavorites when the user moves the mouse over those favorites. You would also need to modify the code where the author does not set a menu ID on some of the sub menus. Either put them into the magic number range or create a new magic number range. Keep in mind that because the status bar was not created with a resource ID... it gets the default MFC id of AFX_IDW_STATUS_BAR. You could change this resource ID and obtain full control over your status bar.

Some additional off-topic comments:
The code sample is poorly written and uses a recursive function for building that menu based on a folder layout on the users hard drive. It would be possible to craft a folder layout that would cause this code sample to recursion until a stack overflow occurred. The code sample also does not handle NTFS junction points which could also be used to generate a stack overflow. If you intend to use this code in a commercial product you may want to re-design the function that builds the favorites menu. I did not perform a full code review so there may be other issues.


Best Wishes,
-David Delaune

modified 4-Jan-12 10:15am.

GeneralRe: Dynamic menu with statusbar messages. Pin
Maximilien4-Jan-12 4:13
Maximilien4-Jan-12 4:13 
GeneralRe: Dynamic menu with statusbar messages. Pin
Randor 4-Jan-12 4:31
professional Randor 4-Jan-12 4:31 
GeneralRe: Dynamic menu with statusbar messages. Pin
Maximilien4-Jan-12 5:22
Maximilien4-Jan-12 5:22 
JokeRe: Dynamic menu with statusbar messages. Pin
Randor 4-Jan-12 5:27
professional Randor 4-Jan-12 5:27 
QuestionConvert CString to CObject VC 6.0 MFC SOLVED Pin
Vaclav_3-Jan-12 8:25
Vaclav_3-Jan-12 8:25 
AnswerRe: Convert CString to CObject VC 6.0 MFC Pin
CPallini3-Jan-12 8:31
mveCPallini3-Jan-12 8:31 
GeneralRe: Convert CString to CObject VC 6.0 MFC Pin
Vaclav_3-Jan-12 8:48
Vaclav_3-Jan-12 8:48 
GeneralRe: Convert CString to CObject VC 6.0 MFC Pin
Vaclav_3-Jan-12 8:49
Vaclav_3-Jan-12 8:49 
GeneralRe: Convert CString to CObject VC 6.0 MFC Pin
ThatsAlok3-Jan-12 19:16
ThatsAlok3-Jan-12 19:16 
QuestionCheck if a window is hidden by another window Pin
Member 29654713-Jan-12 5:48
Member 29654713-Jan-12 5:48 
AnswerRe: Check if a window is hidden by another window Pin
Richard Andrew x643-Jan-12 5:57
professionalRichard Andrew x643-Jan-12 5:57 
AnswerRe: Check if a window is hidden by another window Pin
Randor 3-Jan-12 6:42
professional Randor 3-Jan-12 6:42 
AnswerRe: Check if a window is hidden by another window Pin
Albert Holguin4-Jan-12 9:39
professionalAlbert Holguin4-Jan-12 9:39 
QuestionThread sync Pin
columbos149272-Jan-12 20:05
columbos149272-Jan-12 20:05 
GeneralRe: Thread sync Pin
Randor 2-Jan-12 20:20
professional Randor 2-Jan-12 20:20 
GeneralRe: Thread sync Pin
columbos149272-Jan-12 20:29
columbos149272-Jan-12 20:29 
GeneralRe: Thread sync Pin
Randor 2-Jan-12 21:01
professional Randor 2-Jan-12 21:01 

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.