Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 18th, 2004, 1:27 AM   #1
cfriend
Newbie
 
Join Date: Jul 2004
Posts: 8
Rep Power: 0 cfriend is on a distinguished road
Hi

I start a console process like dir with ShellExecute function. Is there any way to stop this process from my program the time I want ? ( it might be in the middle of execution of the dir command or in the end of execution of dir command )

Thanks
cfriend is offline   Reply With Quote
Old Sep 18th, 2004, 2:03 AM   #2
kurifu
Expert Programmer
 
kurifu's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power: 5 kurifu is on a distinguished road
Send a message via ICQ to kurifu Send a message via MSN to kurifu
Type this on the command line (presuming you have Linux)

man 2 kill

That will give you all the details you need to know. If you are using windows killing a process I think is a bit more involved...
__________________
Clifford Matthew Roche <geek@cliffordroche.com>
Web Hosting: http://www.crd-hosting.com
Consulting: http://www.crdev-consulting.com
kurifu is offline   Reply With Quote
Old Sep 19th, 2004, 7:13 PM   #3
Shatai
Newbie
 
Join Date: Sep 2004
Location: Ontario, Canada
Posts: 6
Rep Power: 0 Shatai is on a distinguished road
Send a message via ICQ to Shatai Send a message via AIM to Shatai Send a message via MSN to Shatai
Hey there,

I advise you explore the option of instead using the ShellExecuteEx function for such a purpose, which will allow you to gain access to the process handle of the console process you spawn.

Naturally, with that process handle, you will be able to call TerminateProcess(HANDLE, UINT) at your own discretion.

Best of luck to you with your endeavour.

References:
http://msdn.microsoft.com/library/en-us/sh....asp?frame=true
http://msdn.microsoft.com/library/en-us/dl....asp?frame=true
Shatai is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:38 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC