forcing focus back to application

liquid8

Freshman
Joined
Jan 14, 2003
Messages
31
I am launching another application using microsoft.visualbasic.shell, and I am using a hotkey control that will register when a key is pressed. Now I need to return focus to my application when that key is pressed. The hotkey event does fire when the key is pressed but does not return focus to my application. How can I do this?

I am using VB.Net if that makes a difference in code.

Thanks,

LiQuiD8
 
got it.. all i had to do was [form].activate, although for anyone that needs it, i did have to check if the form was minimized, otherwise changing focus back to it crashed out. So I just did this:

Visual Basic:
 If CurrentForm.WindowState = Windows.Forms.FormWindowState.Minimized Then
     CurrentForm.WindowState = Windows.Forms.FormWindowState.Normal
End If
CurrentForm.Activate()

LiQuiD8
 
Back
Top