Waiting for an external app to finish

M

Mike

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?
 
M

Mike

In message <[email protected]>
at 00:31:52 on Mon, 7 Dec 2009, Mike
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
 

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

Top