Article View: comp.lang.basic.visual
Article #264Re: A active program !
From: Karsten R�ttger
Date: Tue, 09 Oct 2001 12:28
Date: Tue, 09 Oct 2001 12:28
58 lines
2955 bytes
2955 bytes
'Deklarationen zum Kontrollieren, ob ein Task (Finder) noch l�uft
'Deklarations for controlling
Private Declare Function CloseHandle Lib "kernel32" (ByVal _
hObject As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal _
dwDesiredAccess As Long, ByVal bInheritHandle As _
Long, ByVal dwProcessId As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" _
(ByVal hProcess As Long, lpExitCode As Long) As Long
Private Const STILL_ACTIVE = &H103
Private Const PROCESS_ALL_ACCESS = &H1F0FFF
'Enth�lt die TaskID des Empfangprogramms
'Contains the taskID
Private TaskIDFinder As Double
Private Const cfinder = "C:\Support\Finder.exe"
'controlling code in Timer Event
If Not IsActiveFinder Then
TaskIDFinder = Shell(cfinder, vbNormalFocus)
End If
'Kontrolliert, ob Finder noch l�uft
'Controls, if finder still active
Private Function IsActiveFinder() As Boolean
Dim Handle&, ExitCode&
Handle = OpenProcess(PROCESS_ALL_ACCESS, False, TaskIDFinder)
Call GetExitCodeProcess(Handle, ExitCode)
Call CloseHandle(Handle)
IsActiveFinder = IIf(ExitCode = STILL_ACTIVE, True, False)
End Function
--
Gruss
Karsten
- Ideen aus Folie -
http://www.cd-design.de
Bertman <Bertman@home.nl> schrieb in im Newsbeitrag:
K%Xv7.21236$fo2.2748250@zwoll1.home.nl...
> Hello,
>
> I have to make a program that checks if a program is active. For example:
My
> program starts Calc.exe, and my program have to check every 10sec if
> calc.exe is still active. And when you close Calc.exe then de VB program
> have to give a message.
>
> But I don't know how to check if calc.exe is active.
> I'm using VB 6.0 with SP5
>
> Bertman
>
>
Technical Details
Message-ID:
<OL$lC5LUBHA.1848@tkmsftngp05>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!sn-xit-03!supernews.com!skynet.be!skynet.be!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!tkmsftngp01!tkmsftngp05References:
<K%Xv7.21236$fo2.2748250@zwoll1.home.nl>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: fde1d,35958b3b25d65b87 X-Google-Attributes: gidfde1d,public X-Google-Thread: f51ba,35958b3b25d65b87 X-Google-Attributes: gidf51ba,public X-Google-Thread: f645d,35958b3b25d65b87 X-Google-Attributes: gidf645d,public X-Google-Thread: 101986,35958b3b25d65b87 X-Google-Attributes: gid101986,public X-Google-ArrivalTime: 2001-10-09 05:35:00 PST From: "Karsten R�ttger" <bde@cd-design.de> References: <K%Xv7.21236$fo2.2748250@zwoll1.home.nl> Subject: Re: A active program ! Date: Tue, 9 Oct 2001 14:28:40 +0200 Lines: 60 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Message-ID: <OL$lC5LUBHA.1848@tkmsftngp05> Newsgroups: comp.lang.basic.visual,dk.edb.programmering.basic.visual-basic,microsoft.public.de.vb,microsoft.public.vb NNTP-Posting-Host: pd9029e48.dip.t-dialin.net 217.2.158.72 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!sn-xit-03!supernews.com!skynet.be!skynet.be!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!newsfeed00.sul.t-online.de!t-online.de!tkmsftngp01!tkmsftngp05