Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ina ina is offline
external usenet poster
 
Posts: 120
Default Kill a process - Could someone check this code for me

Hello All,

I have a code that close a process. Could someone check this out for
me.


Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, _
lpExitCode As Long) As Long



Sub ExitPLaunch()
Dim TaskID As Long
Dim hProc As Long
Dim lExitCode As Long
Dim ACCESS_TYPE
Dim STILL_ACTIVE


ACCESS_TYPE = &H400
STILL_ACTIVE = &H103


' Shell the task
TaskID = Shell("C:\program files\PLaunch\PLaunch.EXE, 1)


On Error Resume Next


' Get the process handle
hProc = OpenProcess(ACCESS_TYPE, False, TaskID)

On Error GoTo 0
Application.StatusBar = "Waiting for Packhedge application to
finish"
Do
GetExitCodeProcess hProc, lExitCode
DoEvents
Loop While lExitCode = STILL_ACTIVE


' Ouffa is Finshed
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Kill a process - Could someone check this code for me

This code doesn't kill a process. It shells to the EXE and waits for it to
terminate, or be terminated externally, and then the macro continues.

--
Jim
"ina" wrote in message
ups.com...
| Hello All,
|
| I have a code that close a process. Could someone check this out for
| me.
|
|
| Declare Function GetExitCodeProcess Lib "kernel32" _
| (ByVal hProcess As Long, _
| lpExitCode As Long) As Long
|
|
|
| Sub ExitPLaunch()
| Dim TaskID As Long
| Dim hProc As Long
| Dim lExitCode As Long
| Dim ACCESS_TYPE
| Dim STILL_ACTIVE
|
|
| ACCESS_TYPE = &H400
| STILL_ACTIVE = &H103
|
|
| ' Shell the task
| TaskID = Shell("C:\program files\PLaunch\PLaunch.EXE, 1)
|
|
| On Error Resume Next
|
|
| ' Get the process handle
| hProc = OpenProcess(ACCESS_TYPE, False, TaskID)
|
| On Error GoTo 0
| Application.StatusBar = "Waiting for Packhedge application to
| finish"
| Do
| GetExitCodeProcess hProc, lExitCode
| DoEvents
| Loop While lExitCode = STILL_ACTIVE
|
|
| ' Ouffa is Finshed
| End Sub
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
ina ina is offline
external usenet poster
 
Posts: 120
Default Kill a process - Could someone check this code for me

Ok for kill a process I need only to close the process if it is
running. that is all

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kill Excel Process Mike Moore[_2_] Excel Programming 5 March 17th 05 08:55 AM
How to Kill Excel application process HoGo Excel Programming 2 December 13th 04 10:53 AM
Quit Method do not kill excel process Rui Oliveira Excel Programming 2 January 16th 04 09:38 AM
Quit Method do not kill excel process Rui Oliveira Excel Programming 0 January 15th 04 04:51 PM
to kill a excel process han keat Excel Programming 1 July 18th 03 07:32 AM


All times are GMT +1. The time now is 08:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"