Is there an easy way to restore another application
from the taskbar and set the focus to it from my application?
Printable View
Is there an easy way to restore another application
from the taskbar and set the focus to it from my application?
'paste this into a form, and change the Wintitle variable
N.B THIS CODE WILL NOT WORK IN WIN2K!!! FOR AN EXPLANATIONCode:Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Dim myHWnd As Long
Private Sub Form_Load()
WinTitle = "Distributed COM Configuration Properties"
myHWnd = FindWindowEx(ByVal 0&, ByVal 0&, vbNullString, ByVal WinTitle)
myHWnd = SetForegroundWindow(myHWnd)
End Sub
GO TO http://www.mvps.org/vb/ and look up Karls ForceForeGroundWindow routine
blackholenun
when you post, it would be extra cool if you could put some problem related info in the subject instead of Help Quick! It may actually get you the help quicker (just a friendly tip)
[Edited by crispin on 12-06-2000 at 09:02 AM]
.. or use
AppActivate "App name",True
eg; AppActivate "Microsoft Word",True
.. !
Hi Mark,
Yeah I could've used AppActivate, I tend not to these days,
I get problems with running multiple instances of the same app, and running minimised and maximised instances, when you begin to use combinations of instances and states of windows I have found the behaviour of the above to be a little unpredictable :confused:
(just my 2 penneth)