ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   STILL_ACTIVE (https://www.excelbanter.com/excel-programming/401908-still_active.html)

Arne Hegefors

STILL_ACTIVE
 
Hi! I have a macro that opens another program. It then is supposed to loop
while that other program is still active. This usually works fine but now
there seems to be a problem. I think the other program is working on
something else to begin with. I would really appreciate some help with what
this STILL_ACTIVE means. I get STILL_ACTIVE = 259. What does that mean?

Dim hProc As Long
Dim lExitCode As Long
Dim ACCESS_TYPE
Dim STILL_ACTIVE
Dim lTaskID As Long

ACCESS_TYPE = &H400
STILL_ACTIVE = &H103

'start the bat file
lTaskID = RunBatFile
'get the process handle

MsgBox "stop"

hProc = OpenProcess(ACCESS_TYPE, False, lTaskID)
If Err < 0 Then
Exit Sub
End If
'Wait for the batch program to finish
Do
GetExitCodeProcess hProc, lExitCode
DoEvents
Loop While lExitCode = STILL_ACTIVE

Any help much appreciated!

equiangular

STILL_ACTIVE
 
http://msdn2.microsoft.com/en-us/library/ms683189.aspx

STILL_ACTIVE is a constant, the actual value does not matter


Arne Hegefors wrote:
Hi! I have a macro that opens another program. It then is supposed to loop
while that other program is still active. This usually works fine but now
there seems to be a problem. I think the other program is working on
something else to begin with. I would really appreciate some help with what
this STILL_ACTIVE means. I get STILL_ACTIVE = 259. What does that mean?

Dim hProc As Long
Dim lExitCode As Long
Dim ACCESS_TYPE
Dim STILL_ACTIVE
Dim lTaskID As Long

ACCESS_TYPE = &H400
STILL_ACTIVE = &H103

'start the bat file
lTaskID = RunBatFile
'get the process handle

MsgBox "stop"

hProc = OpenProcess(ACCESS_TYPE, False, lTaskID)
If Err < 0 Then
Exit Sub
End If
'Wait for the batch program to finish
Do
GetExitCodeProcess hProc, lExitCode
DoEvents
Loop While lExitCode = STILL_ACTIVE

Any help much appreciated!


Chip Pearson

STILL_ACTIVE
 
STILL_ACTIVE is a constant, the actual value does not matter

The value doesn't matter!?!?! The value assigned to the constant most
certainly does matter.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)



"Equiangular" wrote in message
...
http://msdn2.microsoft.com/en-us/library/ms683189.aspx

STILL_ACTIVE is a constant, the actual value does not matter


Arne Hegefors wrote:
Hi! I have a macro that opens another program. It then is supposed to
loop while that other program is still active. This usually works fine
but now there seems to be a problem. I think the other program is working
on something else to begin with. I would really appreciate some help with
what this STILL_ACTIVE means. I get STILL_ACTIVE = 259. What does that
mean? Dim hProc As Long
Dim lExitCode As Long
Dim ACCESS_TYPE
Dim STILL_ACTIVE
Dim lTaskID As Long
ACCESS_TYPE = &H400
STILL_ACTIVE = &H103
'start the bat file
lTaskID = RunBatFile
'get the process handle
MsgBox "stop"
hProc = OpenProcess(ACCESS_TYPE, False, lTaskID)
If Err < 0 Then
Exit Sub
End If
'Wait for the batch program to finish
Do
GetExitCodeProcess hProc, lExitCode
DoEvents
Loop While lExitCode = STILL_ACTIVE

Any help much appreciated!



equiangular

STILL_ACTIVE
 
Sorry that I could not express my view clearly in the previous post.

What I mean is as long as you get the correct definition of
STILL_ACTIVE, the code will run correctly.
There is need to know why the value of STILL_ACTIVE is 259. It is given
by the function definition.

Chip Pearson wrote:
STILL_ACTIVE is a constant, the actual value does not matter


The value doesn't matter!?!?! The value assigned to the constant most
certainly does matter.




All times are GMT +1. The time now is 06:03 PM.

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