|
-
Dec 6th, 2000, 08:12 AM
#1
Thread Starter
New Member
Is there an easy way to restore another application
from the taskbar and set the focus to it from my application?
-
Dec 6th, 2000, 08:59 AM
#2
Fanatic Member
'paste this into a form, and change the Wintitle variable
Code:
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
N.B THIS CODE WILL NOT WORK IN WIN2K!!! FOR AN EXPLANATION
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]
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
-
Dec 6th, 2000, 09:06 AM
#3
Frenzied Member
.. or use
AppActivate "App name",True
eg; AppActivate "Microsoft Word",True
.. !
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Dec 6th, 2000, 09:32 AM
#4
Fanatic Member
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 
(just my 2 penneth)
Crispin
VB6 ENT SP5
VB.NET
W2K ADV SVR SP3
WWW.BLOCKSOFT.CO.UK
[Microsoft Basic: 1976-2001, RIP]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|