|
Home > Archive > dBASE Windows API > April 2005 > Check to see if a window program is running
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Check to see if a window program is running
|
|
| Thom Konich 2005-04-24, 7:24 am |
| Hello,
Is there a way to determine if a non dBase Windows program is running?
Senerio:
If it's running
Do this
Else
Do this
Endif
| |
| Ken Mayer [dBVIPS] 2005-04-24, 8:23 pm |
| Thom Konich wrote:
> Hello,
>
> Is there a way to determine if a non dBase Windows program is running?
>
> Senerio:
>
> If it's running
> Do this
> Else
> Do this
> Endif
There is code in the dUFLP that you might want to check out (it's a
freeware library of code, available from my website:
http://www.goldenstag.net/dbase) -- it will be in the file MiscAPI.prg.
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Christopher F. Neumann 2005-04-24, 8:24 pm |
| You can get the handle of the open window very easily if you know what should be in the window title bar.
extern chandle FindWindow(cstring,c
string) user32 from "FindWindowA"
private myhandle
myhandle= FindWindow(0,"someapplication")
if myhandlw > 0
do whatever
else
app not running
endif
--
Christopher F. Neumann
[dBASE Gold Charter Member 107]
Blue Star Visual dBASE graduate
IWA-HWG Web Technologies Certified
IWA-HWG Web Programming Certified
ICCP TCP/IP Network Analyst
Data Communications Engineer
http://cfneumann.us
"Just hanging out on the Sagittarian arm of the Milky Way"
Ken Mayer [dBVIPS] wrote:
> Thom Konich wrote:
>
> There is code in the dUFLP that you might want to check out (it's a
> freeware library of code, available from my website:
> http://www.goldenstag.net/dbase) -- it will be in the file MiscAPI.prg.
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase
| |
| Thom Konich 2005-04-28, 7:24 am |
| Hi Ken,
I took your advice and found the code below. I ran the program to check to see if i would get the results I need. The function only returns false. I have confirmed that both programs are running. Am I missing something
If isrunning( "explorer.exe" )
Answer = "yes"
else
Answer = "no"
endif
?Answer
?isrunning( "vcadd5.exe" )
/*
----------------------------------------------------------------
A quick and dirty check to see if an external
Windows program is executing.
Returns a logical true/false.
Based on a posting on the Inprise Newsgroups
by Angelo Bocchini, January 24, 1999.
Usage:
do while isRunning( "wordpad.exe" )
sleep 2
enddo
----------------------------------------------------------------
*/
function isRunning( cProg )
if type( "GetModuleHandle" ) # "FP"
extern CHANDLE GetModuleHandle( CSTRING ) kernel32 ;
from "GetModuleHandleA"
endif
return ( GetModuleHandle( cProg ) > 0 )
// eof: isRunning()
Thanks
Thomas Konich
Ken Mayer [dBVIPS] Wrote:
> Thom Konich wrote:
>
> There is code in the dUFLP that you might want to check out (it's a
> freeware library of code, available from my website:
> http://www.goldenstag.net/dbase) -- it will be in the file MiscAPI.prg.
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase
| |
| Ken Mayer [dBVIPS] 2005-04-28, 7:24 am |
| Thom Konich wrote:
> Hi Ken,
>
> I took your advice and found the code below. I ran the program to check to see if i would get the results I need. The function only returns false. I have confirmed that both programs are running. Am I missing something
>
> If isrunning( "explorer.exe" )
> Answer = "yes"
> else
> Answer = "no"
> endif
> ?Answer
> ?isrunning( "vcadd5.exe" )
You might need to give the full path to the exe file?
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Paul Van House 2005-04-28, 9:23 am |
| In article <s3BY#kSSFHA.1188@news-server>, chris@cfneumann.us says...
> extern chandle FindWindow(cstring,c
string) user32 from "FindWindowA"
>
The only drawback is you must have the exact text. If the frameWindow
text changes during execution (Such as "Inbox - Microsoft Outlook" and
"Calendar - Microsoft Outlook") you'd have to test every possible
combination
--
Paul Van House
(remove _removeme_ from mail address for e-mail replies)
Radio/TV software and baseball statistics software:
http://www.binxsoftware.com
Family Home Page: http://www.binxsoftware.com/vanhouse
Church Home Page: http://www.ashfordumc.org
|
|
|
|
|