|
-
May 7th, 2001, 11:21 AM
#1
You can use FindWindow as in this code to check if a program (with window caption "XYZ") is already loaded. If it is it swaps focus to that instance and then ends. You also have to declare functions for ShowWindow and BringWindowToTop
Dim rval As Long
Dim findhwnd As Long
Dim strNull As String
findhwnd = FindWindow(strNull, "XYZ")
If findhwnd <> 0 Then
rval = ShowWindow(findhwnd, 1)
rval = BringWindowToTop(findhwnd)
End
End If
-
May 7th, 2001, 03:38 PM
#2
FindWindow has been replaced by FindWindowEx, which will allow you to search Child Windows as well as top-level windows.
-
May 7th, 2001, 09:52 PM
#3
FindWindow has been replaced by FindWindowEx, which will allow you to search Child Windows as well as top-level windows.
FindWindow wasn't really replaced. FindWindowEx had been around for a long time, and there is nothing in the MSDN Library telling you that you should start using FindWindowEx all the time, even when you aren't just looking for child windows (If you find any, let me know).
FindWindowEx is just a supplement to FindWindow for if you want to search child windows (Though it can be used as a replacement, don't get me wrong).
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
|