Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Yousfi Benameur
  Where is Yousfi Benameur?
 El Bayadh
 Algeria
 Yousfi Benameur
 To: Markus Raab
  Where is Markus Raab?
 Bad Kötzting
 Germany
 Markus Raab
 Tags
Subject: RE: Control Process
Thread ID: 201250 Message ID: 201320 # Views: 32 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Win32API programming
Date: Sunday, November 02, 2008 1:35:56 PM         
   


> Hello Yousfi,
>
>
> the program ist running - many thanks. Now i can control and stop a process. There is a little error in your script:
>
> If you want to kill a process:
>
>
> FOR EACH loProcess IN loResult
> if allt(loProcess.name)="yourexe"
> loProcess.Terminate(0)
> endi
> NEXT
>
>
> At all: many thanks, my problem is now solved.
>
>
> Best Regards,
>
>
> Markus
>
>
>
>
>
>
> > Welcome
> >
> > I give you a small script who can returns you a the answer.
> > put your exec name in "yourexe" (juststem only)
> >
> > LOCAL loWMI, lcQuery, loResult, loProcess
> > loWMI = GetObject("winmgmts://")
> > lcQuery = "select * from win32_process where name='"+yourexe+"'"
> > loResult = loWMI.ExecQuery(m.lcQuery)
> > 
> > if loResult.count=0
> > *well ..Run your programm run/n 
> > else
> > oo="Application running"
> > messagebox(yourexe+" is already running !",0+32+4096,oo)
> > endi
> > 

> >
> > if you want to kill your application "yourexe" if running terminate the script above with this
> >
> > FOR EACH loProcess IN loResult
> > if loProcess.name="yourexe"
> >    loProcess.Terminate(0)
> > endi	
> > NEXT
> > 

> >
> > You can also use windows API (FindWindowEx).se this News2News link where you must know the title of your window appplication.
> >
> > http://www.news2news.com/vfp/?function=-1&example=45
> >
> > You must modify it a bit for testing if your window title is in the cursor.
> >
> > count for  "Yout application exact title" $ wintitle to xrun
> > if xrun=0
> > *application not running
> > else
> > *application running
> > endi
> > 

> > you can also see this link in the same subject
> > http://www.ml-consult.co.uk/foxst-11.htm
> > Regards
> > Yousfi Benameur

That if you have SET EXACT ON -i have SET EXCAT OFF (default) on my vfp.
ON :Specifies that expressions must match character for character when comparing character data, to be equivalent.


Don Kechen



COMPLETE THREAD
Control Process Posted by Markus Raab @ 11/1/2008 2:15:00 PM
RE: Control Process Posted by Frank Cazabon @ 11/1/2008 2:23:17 PM
RE: Control Process Posted by Yousfi Benameur @ 11/1/2008 2:33:51 PM
RE: Control Process Posted by Markus Raab @ 11/2/2008 10:19:31 AM
RE: Control Process Posted by Yousfi Benameur @ 11/2/2008 1:35:56 PM
RE: Control Process Posted by Carlos Alloatti @ 11/1/2008 5:14:12 PM