#### Archived

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

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

## Recommended Posts

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 on other sites
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 on other sites
File ()
->Open.. (ID_FILE_OPEN)
->Close (ID_FILE_CLOSE)
->Save (ID_FILE_SAVE)
->Exit (ID_FILE_EXIT)

Help

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].

• ### Forum Statistics

• Total Topics
628378
• Total Posts
2982334

• 10
• 9
• 15
• 24
• 11