ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   question about FindWindow API call (https://www.excelbanter.com/excel-programming/408526-question-about-findwindow-api-call.html)

xlrotor[_2_]

question about FindWindow API call
 
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

Peter T

question about FindWindow API call
 
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




"xlrotor" wrote in message
...
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




Brian Murphy

question about FindWindow API call
 
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


All times are GMT +1. The time now is 07:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com