|
-
June 20th, 2002, 08:57 PM
#1
Executing MS DOS commands from Windows app
Hi,
I seem to have completely forgotten how to execute a MS DOS command from a Windows app! Can you help?
I just want to execute the copy command!
Thanks,
Daniel
-
June 20th, 2002, 11:56 PM
#2
Use system function like
Hope it helps.
-
June 21st, 2002, 12:10 PM
#3
Thanks for your help. It was very obvious. I just had a mental block.
But is there a way to copy a file with out having the Console screen come up?
Daniel
-
June 21st, 2002, 01:34 PM
#4
ShellExecute( "c:\\MyProgram.exe", SW_HIDE);
-
June 21st, 2002, 07:18 PM
#5
For some powerful Win32 API file operation routines, try looking up SHFileOperation() in MSDN.
-
June 21st, 2002, 10:26 PM
#6
You can use the CopyFile() API function
There are several methods for launching another program from one program.
You can use _spawn(), _exec(), system(), WinExec(), ShellExecute(), ShellExecuteEx(), and CreateProcess().
The system() function is a more portable function.
WinExec(), ShellExecute(), ShellExecuteEx(), and CreateProcess() are unique to Windows programming. All four windows functions allow for launching an application in the background (window-hidden).
The WinExec() is the easiest of the four to use. It only takes two arguments, however MS recommends using the CreateProcess() instead of WinExec on all 32-bit programs.
See the following link for more details:
http://www.axter.com/faq/topic.asp?T...le=C%2FC%2B%2B
-
July 15th, 2002, 05:40 PM
#7
Thanks Bob,
The SHFileOperation() did the trick very nicely
Daniel
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|