Return focus to prev app

Posted on 2006-05-23
Medium Priority
Last Modified: 2010-05-01

the app i'm developing runs as an overlay (prints some text on the screen)

now when the user presses ctrl + alt + o they can edit the options.
whenever this options screen closes, focus should not be set to the text displayed on screen, but to the app that had focus before the options screen was opened.

how can i reach this goal?

Question by:Mark_FreeSoftware
  • 2
LVL 29

Accepted Solution

nffvrxqgrcfqvvc earned 1500 total points
ID: 16742806
Private Declare Sub SwitchToThisWindow Lib "user32" ( _
    ByVal hwnd As Long, _
    ByVal fAltTab As Boolean)

Private Sub Command1_Click()
    SwitchToThisWindow Me.hwnd, False
End Sub
LVL 13

Author Comment

ID: 16742999

that's one piece (the switching)

but how can i know what app had focus before mine?


i am doing somthing in word,
than i decide i want to change somthing and i open the options screen.
i close it, and word doesnt get focus
however when i just close my app, word is getting focus
LVL 13

Author Comment

ID: 16952588

thanks for your help this far,

i'm going to reward you points for trying to help me

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month9 days, 16 hours left to enroll

569 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