Thread View: borland.public.cppbuilder.nativeapi
7 messages
7 total messages
Started by vortic
Sat, 14 Oct 2006 20:02
Open cmd.exe from shortcut, execute command
Author: vortic
Date: Sat, 14 Oct 2006 20:02
Date: Sat, 14 Oct 2006 20:02
11 lines
1390 bytes
1390 bytes
I have a VCL form application, and on a button onClick Event, I want to open a shortcut (CmdShortcut) pointing to cmd.exe, and run some command window application (SomeApp.exe) within the command window. I have no idea how to do this because I can't seem to use the online help very effectively. I can't even figure out how to execute any app or get a command line. I'm using Turbo C++ Explorer on XP SP2. Any help appreciated. p.s. Should have I posted this to cppbuilder.language.cpp ??
Re: Open cmd.exe from shortcut, execute command
Author: Jonathan Benedicto
Date: Sat, 14 Oct 2006 22:53
Date: Sat, 14 Oct 2006 22:53
21 lines
1602 bytes
1602 bytes
vortic wrote: >I have a VCL form application, and on a button onClick Event, I want to >open a shortcut (CmdShortcut) pointing to cmd.exe, and run some command >window application (SomeApp.exe) within the command window. I have no idea >how to do this because I can't seem to use the online help very >effectively. I can't even figure out how to execute any app or get a >command line. You can either use ShellExecute or CreateProcess. Eg: ShellExecute( NULL, "open", "myapp.exe", "", NULL, SW_SHOWDEFAULT ); > p.s. Should have I posted this to cppbuilder.language.cpp ?? No, this is the correct group. HTH Jonathan
Re: Open cmd.exe from shortcut, execute command
Author: vortic
Date: Sun, 15 Oct 2006 00:59
Date: Sun, 15 Oct 2006 00:59
20 lines
1807 bytes
1807 bytes
"Jonathan Benedicto" <invalid@nobody.com> wrote in message news:45316a45$1@newsgroups.borland.com... > vortic wrote: >>I have a VCL form application, and on a button onClick Event, I want to >>open a shortcut (CmdShortcut) pointing to cmd.exe, and run some command >>window application (SomeApp.exe) within the command window. I have no idea >>how to do this because I can't seem to use the online help very >>effectively. I can't even figure out how to execute any app or get a >>command line. > > You can either use ShellExecute or CreateProcess. Excellent. I open Cmd.exe instead of the app directly, as I like to run it through a command window because the app auto closes and I like to look at the output. I could not figure out how to get ShellExecute to open a shortcut, but that is ok. Thanks, vortic
Re: Open cmd.exe from shortcut, execute command
Author: Michel Leunen
Date: Sun, 15 Oct 2006 09:31
Date: Sun, 15 Oct 2006 09:31
17 lines
1449 bytes
1449 bytes
vortic wrote: > I could not figure out how to get ShellExecute to open a > shortcut, but that is ok. A shortcut is like other files and has an .lnk extension. Just do ShellExecute( NULL, "open", "your_link.lnk", "", NULL, SW_SHOWDEFAULT ); Michel -- ---------------------------------------- Michel Leunen mailto: see my homepage. C++Builder, BCC5.5.1 Web site: http://www.leunen.com/ ----------------------------------------
Re: Open cmd.exe from shortcut, execute command
Author: Remy Lebeau (TeamB)
Date: Mon, 16 Oct 2006 17:24
Date: Mon, 16 Oct 2006 17:24
19 lines
1556 bytes
1556 bytes
"vortic" <vortic@users.sourceforge.net> wrote in message news:4531423c$1@newsgroups.borland.com... > I have a VCL form application, and on a button onClick Event, I want > to open a shortcut (CmdShortcut) pointing to cmd.exe You do not need to execute the shortcut. You can execute cmd.exe itself directly. Use the CreateProcess() function for that. > and run some command window application (SomeApp.exe) within the command window. Then you do not need to run cmd.exe at all. You can run SomeApp.exe directly instead. If it is a console application, then it will show the console window automatically. Gambit
Re: Open cmd.exe from shortcut, execute command
Author: Remy Lebeau (TeamB)
Date: Mon, 16 Oct 2006 17:27
Date: Mon, 16 Oct 2006 17:27
16 lines
1622 bytes
1622 bytes
"vortic" <vortic@users.sourceforge.net> wrote in message news:453187e4$1@newsgroups.borland.com... > I open Cmd.exe instead of the app directly, as I like to run it through > a command window because the app auto closes and I like to look > at the output. If you use CreateProcess() to run the console application directly, you can capture the output and display it in your own program. CreateProcess() allows you to assign your own handles for STDIN/STDOUT/STDERR. So your program could use CreatePipe() to create handles for STDOUT and STDERR, and then use ReadFile() to receive any data the console application outputs. Gambit
Re: Open cmd.exe from shortcut, execute command
Author: vortic
Date: Tue, 17 Oct 2006 06:14
Date: Tue, 17 Oct 2006 06:14
19 lines
1788 bytes
1788 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message > > "vortic" >> I open Cmd.exe instead of the app directly, as I like to run > it through >> a command window because the app auto closes and I like to look >> at the output. > > If you use CreateProcess() to run the console application directly, you > can > capture the output and display it in your own program. CreateProcess() > allows you to assign your own handles for STDIN/STDOUT/STDERR. So your > program could use CreatePipe() to create handles for STDOUT and STDERR, > and > then use ReadFile() to receive any data the console application outputs. > Perfect. This is exactly what I really want anyway. I'll give this a shot. Thanks Remy
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads