ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Waiting for an external app to finish (https://www.excelbanter.com/excel-programming/437093-waiting-external-app-finish.html)

Mike[_111_]

Waiting for an external app to finish
 
I am using XL2003 on WinXP

I have a piece of code I call waiting for me to close down my email
client which I call from excel (it's not outlook so I can't do any fancy
object stuff) - basically I am doing a goto URL with a mailto link
prepared


Anyway this is the code I am using

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Function IsRunning(psTaskName As String) As Boolean

If FindWindow(vbNullString, psTaskName) < 0 Then
IsRunning = True
End If

End Function

Last time I know this was working was in August this year. Maybe a
WinXP update has changed the behaviour of the libraries? My program is
just looping round, even though I know the program isn't on the task
list,

Is there another way of doing this, and/or is there also a way of
listing all the windows running so I can at least try and work out what
the problem is please?
--
Mike News

Mike[_111_]

Waiting for an external app to finish
 
In message
at 00:31:52 on Mon, 7 Dec 2009, Mike
S wrote
I am using XL2003 on WinXP

I have a piece of code I call waiting for me to close down my email
client which I call from excel (it's not outlook so I can't do any fancy
object stuff) - basically I am doing a goto URL with a mailto link
prepared


Anyway this is the code I am using

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Function IsRunning(psTaskName As String) As Boolean

If FindWindow(vbNullString, psTaskName) < 0 Then
IsRunning = True
End If

End Function

Last time I know this was working was in August this year. Maybe a
WinXP update has changed the behaviour of the libraries? My program is
just looping round, even though I know the program isn't on the task
list,

Is there another way of doing this, and/or is there also a way of
listing all the windows running so I can at least try and work out what
the problem is please?

Slight update - it's something to do with the length of the task name,
but nothing's changed - the excel code, or the name of the task (which
is based on an ebay auction title - and I haven't changed any of the
lengths)

Anyway, I can probably work around it, although if there is a better
way, I'd love to hear from anyone

Cheers
--
Mike News


All times are GMT +1. The time now is 12:36 PM.

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