Archived

This topic is now archived and is closed to further replies.

Clash Rocker

[Win32 API]Not lossing window focus when user clicks on a menu.

Recommended Posts

Clash Rocker    130
I have some edit controls on my dialog box. When the controls
EN_KILLFOCUS 
I up date the values in memory, so when user comes back to that dialog the values that were last inputed will there. My porblem is that when the user makes a change and then click on the menu "File" for example, the contorl doesn''t loss focus...unless "File" call a up a dialog or something...but it can''t, it''s the root of the menu resource. Anyways how can I solve this problem of not losing focus when the user clicks on the menu? TIA

Share this post


Link to post
Share on other sites
Mike    141
Here''s a guess. It seems to me that when you click on a menu, a WM_COMMAND message gets sent to the window. Just check to see if that message was generated by a menu. If so call SetFocus and set the focus to something else.

Share this post


Link to post
Share on other sites
Clash Rocker    130
OK here''s my menu:
File ()
->Open.. (ID_FILE_OPEN)
->Close (ID_FILE_CLOSE)
->Save (ID_FILE_SAVE)
->Exit (ID_FILE_EXIT)

Help
->About (ID_HELP_ABOUT)
->Readme (ID_HELP_README)

I can only trap the "submenus" Open and etc. I can''t trap "File" and "Help" because I can''t create a resource ID for them [File and Open].

Share this post


Link to post
Share on other sites