C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 28695
Number of posts: 94715

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
the system() function Posted by yanghui1023 on 9 Jul 2006 at 12:25 AM
I've used the system funtion in stdlib.h but when I use it to run an executive file,the DOS window appears.How can I remove the DOS window?

eg,I've achieved a player and a caculator& and a dialog with 2 buttons,when I click button1,then I want the player appear,and so dose with the caculator when I click button2.So in the message process funtion of button1 I used system() to run the executive file of player.
the main code is:

void CProjectDlg::Onplayer()
{
// TODO: Add your command handler code here
system("player");/* player is the name of the player's
executive file */
system("exit"); // i want to exit from dos window bu failed.
}

void CProjectDlg::Oncaculator()
{
// TODO: Add your command handler code here
system("caculator");
system("exit");
}

Is anyone knows how to remove the Dos window thanks.
Yang Hui


Report
Re: the system() function Posted by Eric Tetz on 9 Jul 2006 at 1:17 AM
Use CreateProcess.
Report
Re: the system() function Posted by yanghui1023 on 9 Jul 2006 at 2:40 AM
: Use CreateProcess.
:
can you describe it concretly?
thank you!
Report
Re: the system() function Posted by Gregry2 on 9 Jul 2006 at 3:37 AM
: : Use CreateProcess.
: :
: can you describe it concretly?
: thank you!
:

http://www.google.com/search?hl=en&lr=&q=CreateProcess%28%29&btnG=Search

or

http://www.google.com/search?hl=en&lr=&q=CreateProcess&btnG=Search

http://www.google.com/ always works :) It also helps to have a copy of the Win32 API help files on you computer, if you can't get onto msdn all the time. I got mine somewhere on the site for mingw...you can search it out, I'm sure.
{2}rIng
Report
Re: the system() function Posted by yanghui1023 on 9 Jul 2006 at 10:08 AM
This message was edited by yanghui1023 at 2006-7-9 10:11:7

: : : Use CreateProcess.
: : :
: : can you describe it concretly?
: : thank you!
: :
:
: http://www.google.com/search?hl=en&lr=&q=CreateProcess%28%29&btnG=Search
:
: or
:
: http://www.google.com/search?hl=en&lr=&q=CreateProcess&btnG=Search
:
: http://www.google.com/ always works :) It also helps to have a copy of the Win32 API help files on you computer, if you can't get onto msdn all the time. I got mine somewhere on the site for mingw...you can search it out, I'm sure.
: {2}rIng
:




thank you very much

I succeeded.But what to do if I want end the process I've just created.
which fuction should I use?




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.