Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Trapping Edit Box Focus Events in VC++

Posted on 2003-03-10
6
Medium Priority
?
651 Views
Last Modified: 2012-06-27
I currently trap the EN_SETFOCUS and EN_KILLFOCUS events to perform pre and post edit box processing.  This works correctly until the users swaps to another application while an edit box has the focus.  The edit box physically loses focus but not logically.  How do I trap the ENTER and EXIT events in VC++ that are present in VB and Delphi?
0
Comment
Question by:wtfinc
  • 3
  • 2
6 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 8102982
When a user switches to a different application, the previous app in use should receive a WM_KILLFOCUS. That should work...
0
 

Author Comment

by:wtfinc
ID: 8103032
When the user switches to a different application, I want the focus to stay in the edit box because the user has not finished entering data.  I need to trap an event other than the WM_KILLFOCUS.  My question is which event and how do I trap it?
0
 
LVL 86

Expert Comment

by:jkr
ID: 8103174
>> I want the focus to stay in the edit box

With another app being activated?
0
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!

 

Author Comment

by:wtfinc
ID: 8103256
Yes.  When the user comes back to my app, I want the focus to still be in the same edit box they were in when they left.  I believe this is the way the OnEnter and OnExit events work in VB and Delphi.  Switching to another application when an edit box has the focus will fire the KillFocus event but not the Exit event.  Hitting the TAB, ENTER or clicking on another control would fire the Exit event.
0
 
LVL 3

Accepted Solution

by:
cmaryus earned 1500 total points
ID: 8103630
You can use Spy++ from "Microsoft Visual Studio 6.0 Tools" menu. with it you can see all the messages that a window receives.
0
 

Author Comment

by:wtfinc
ID: 8104367
Good Suggestion.  There doesn't appear to be any events generated other than the KILLFOCUS.  I'll have to examine which new control has the focus in my KILLFOCUS event handler.  If null, I'll assume the user has swapped applications.  Thanks for the help
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
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 pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

572 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