Article View: comp.lang.basic.visual
Article #263Re: A active program !
From: Mike Labosh
Date: Mon, 08 Oct 2001 19:34
Date: Mon, 08 Oct 2001 19:34
36 lines
2461 bytes
2461 bytes
You use the FindWindow API function to get the window handle of the window
you want. Then you call GetWindow in a loop until it returns 0, then you
know the other window has been closed:
lHwnd = FindWindow(...)
While GetWindow(...) <> 0
DoEvents
Wend
In your case, if you wish to poll every x seconds, you can put the above
code in the timer event of a control and modify it so that it does something
else when the window disappears, or you could call the Sleep API function
instead of DoEvents.
--
Peace and happy computing,
Mike Labosh, MCP, MCT, MCSD
"Hit any user to continue."
"Bertman" <Bertman@home.nl> wrote in message
news: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:
<xdnw7.1098$IB1.2169@news3.voicenet.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!feed2.news.rcn.net!rcn!news.voicenet.com!news3.voicenet.com.POSTED!not-for-mailReferences:
<K%Xv7.21236$fo2.2748250@zwoll1.home.nl>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f51ba,35958b3b25d65b87 X-Google-Attributes: gidf51ba,public X-Google-Thread: fde1d,35958b3b25d65b87 X-Google-Attributes: gidfde1d,public X-Google-Thread: 101986,35958b3b25d65b87 X-Google-Attributes: gid101986,public X-Google-Thread: f645d,35958b3b25d65b87 X-Google-Attributes: gidf645d,public X-Google-ArrivalTime: 2001-10-08 12:34:56 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!feed2.news.rcn.net!rcn!news.voicenet.com!news3.voicenet.com.POSTED!not-for-mail Reply-To: "Mike Labosh" <mlabosh@vbsensei.com> From: "Mike Labosh" <mlabosh@vbsensei.com> Newsgroups: comp.lang.basic.visual,dk.edb.programmering.basic.visual-basic,microsoft.public.de.vb,microsoft.public.vb References: <K%Xv7.21236$fo2.2748250@zwoll1.home.nl> Subject: Re: A active program ! Lines: 38 Organization: vbSensei.Com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Message-ID: <xdnw7.1098$IB1.2169@news3.voicenet.com> Date: Mon, 08 Oct 2001 19:34:53 GMT NNTP-Posting-Host: 207.103.105.106 X-Complaints-To: abuse@voicenet.com X-Trace: news3.voicenet.com 1002569693 207.103.105.106 (Mon, 08 Oct 2001 15:34:53 EDT) NNTP-Posting-Date: Mon, 08 Oct 2001 15:34:53 EDT