question about FindWindow API call

  • Thread starter Thread starter xlrotor
  • Start date Start date
X

xlrotor

Is FindWindow a reliable way to determine if a particular application
is currently running?

I had been using Tasklist.exe to do this, but this program does not
appear to be present on Windows XP Home systems.

Thanks
 
I can't imagine why it would not be a fast and reliable way to determine if
an app is open, providing you know it's window class name. FWIW much faster
than say GetObject (assuming that works with the app in question).

Function IsWordRunning() As Long
Dim hWin As Long
Const WORD_CLASSNAME As String = "OpusApp"
hWin = FindWindow(WORD_CLASSNAME, vbNullString)

IsWordRunning = hWin
End Function

However you can make your own TaskList with the following
http://support.microsoft.com/kb/q187913/

Regards,
Peter T
 
Thank you, Peter.

I am going to change my production code to use the API call.
FindWindow has worked just right in all the testing I've done. Which
is more than I can say for Tasklist.exe.

I looked at the microsoft page you mentioned, and I think FindWindow
looks like the best way to go.

Cheers,

Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top