|
-
Mar 3rd, 2003, 11:33 AM
#1
Thread Starter
Fanatic Member
FindWindow ?
I would like to search threw all running programs (hidden or not) for my application named "Bob"...
I think the function I should use is FindWindow, however, I can't get any exemples on how to use it ... Could anyone please post a sample code for this?
The function:
VB Code:
Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
or
VB Code:
Declare Function FindWindowWithNull Lib "user32" -
Alias "FindWindowA" (ByVal lpClassName As Long, _
ByVal lpWindowName As String) As Long
So... waiting for an answer
-
Mar 3rd, 2003, 11:49 AM
#2
is you app called bob.exe or is the caption of the window "bob" because findwindow searches by its 2 params.. 1 is the class, and 2 (which is what you will probably use) is the windows caption name... now you can also search each process for the actual exe name if that is what you are looking for.. but that envolves some more api work to enum the processes
-
Mar 3rd, 2003, 11:53 AM
#3
Thread Starter
Fanatic Member
Originally posted by kleinma
is you app called bob.exe or is the caption of the window "bob" because findwindow searches by its 2 params.. 1 is the class, and 2 (which is what you will probably use) is the windows caption name... now you can also search each process for the actual exe name if that is what you are looking for.. but that envolves some more api work to enum the processes
App Window: "bob",
App Exe Name "BobName.exe"
App Exe Path "C:\BobPath"
...
As you might have noticed, I just want a sample code
...
The only thing I want to know: Is it running?
-
Mar 3rd, 2003, 11:56 AM
#4
VB Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
if FindWindow(vbNullString,"bob") = 0 then
msgbox "BOB NOT RUNNING"
else
msgbox "BOB IS RUNNING"
end if
End Sub
-
Mar 3rd, 2003, 12:03 PM
#5
Thread Starter
Fanatic Member
Now your talking!
Originally posted by kleinma
VB Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
if FindWindow(vbNullString,"bob") = 0 then
msgbox "BOB NOT RUNNING"
else
msgbox "BOB IS RUNNING"
end if
End Sub
Thanks!
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
|