Click here to Skip to main content
15,921,660 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Enter to Select button Pin
valikac24-Feb-03 9:23
valikac24-Feb-03 9:23 
GeneralRe: Enter to Select button Pin
sstiller26-Feb-03 19:09
sstiller26-Feb-03 19:09 
GeneralDelete a security group in VC 7.0 Pin
Member 13661824-Feb-03 5:49
Member 13661824-Feb-03 5:49 
GeneralRe: Delete a security group in VC 7.0 Pin
Dana Epp24-Feb-03 7:59
Dana Epp24-Feb-03 7:59 
Generallaunching dos programs(gui) Pin
eggman2124-Feb-03 5:39
eggman2124-Feb-03 5:39 
GeneralRe: launching dos programs(gui) Pin
jmkhael24-Feb-03 5:43
jmkhael24-Feb-03 5:43 
GeneralRe: launching dos programs(gui) Pin
eggman2124-Feb-03 7:04
eggman2124-Feb-03 7:04 
GeneralRe: launching dos programs(gui) Pin
Dana Epp24-Feb-03 14:46
Dana Epp24-Feb-03 14:46 
Well, I have always been a pipes kinda guy and would normally recommend you look at popen() as it is much easier than CreateProcess, and is alittle more portable. But since you asked to see it as CreateProcess() I would recommend you check out http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q190351&[^] for sample code on spawning console apps and grabbing the handles to do intelligent things to it (control input/output etc).

Of course... if you wanted to know how to do it quick and dirty with popen, consider something like:

#include <stdio.h>
#include <stdlib.h>

int main()
{

  char   psBuffer[256];
  FILE   *pFile;

  /* Spawn "program_name.exe" so it writes its output to a pipe, 
   * which we can then read like a text file 
   */
  if( (pFile = _popen( "program_name.exe", "-h" )) == NULL )
     exit( 1 );
<BR><BR>
  /* Read pipe until EOF. */ 
  while( !feof( pFile ) )
  {
     if( fgets( psBuffer, 256, pFile ) != NULL )
        printf( psBuffer );
  }

  /* Close the pipe and print the return value of pFile. */
  printf( "Process returned %d\n", _pclose( pFile ) );
}


Or something like that. That code may not work virbatim as I am writing that off the cuff in a browser Smile | :)

Anyways, I hope that link will help you with the CreateProcess() way of doing things. I like popen() when getting down and dirty but I find myself using CreateProcess() more now adays because I can attach a Security Descriptor to the thing. Your milage may vary.

Good luck!

- Dana Cool | :cool:
GeneralRe: launching dos programs(gui) Pin
eggman2125-Feb-03 5:05
eggman2125-Feb-03 5:05 
Generalsimple C function question Pin
Maximilien24-Feb-03 5:33
Maximilien24-Feb-03 5:33 
GeneralRe: simple C function question Pin
jmkhael24-Feb-03 5:36
jmkhael24-Feb-03 5:36 
GeneralCTime question Pin
Anonymous24-Feb-03 4:53
Anonymous24-Feb-03 4:53 
GeneralRe: CTime question Pin
João Paulo Figueira24-Feb-03 5:09
professionalJoão Paulo Figueira24-Feb-03 5:09 
GeneralRe: CTime question Pin
jhwurmbach24-Feb-03 5:09
jhwurmbach24-Feb-03 5:09 
GeneralRe: CTime question Pin
Alvaro Mendez24-Feb-03 5:25
Alvaro Mendez24-Feb-03 5:25 
GeneralRe: CTime question Pin
Anonymous24-Feb-03 5:27
Anonymous24-Feb-03 5:27 
GeneralRe: CTime question Pin
Dave_24-Feb-03 9:39
Dave_24-Feb-03 9:39 
GeneralCopy constructor Pin
Jerome Conus24-Feb-03 4:27
Jerome Conus24-Feb-03 4:27 
GeneralRe: Copy constructor Pin
João Paulo Figueira24-Feb-03 4:37
professionalJoão Paulo Figueira24-Feb-03 4:37 
GeneralRe: Copy constructor Pin
Jerome Conus24-Feb-03 4:43
Jerome Conus24-Feb-03 4:43 
GeneralRe: Copy constructor Pin
João Paulo Figueira24-Feb-03 4:50
professionalJoão Paulo Figueira24-Feb-03 4:50 
GeneralRe: Copy constructor Pin
Jerome Conus24-Feb-03 4:53
Jerome Conus24-Feb-03 4:53 
GeneralRe: Copy constructor Pin
João Paulo Figueira24-Feb-03 5:02
professionalJoão Paulo Figueira24-Feb-03 5:02 
GeneralRe: Copy constructor Pin
Jerome Conus24-Feb-03 5:06
Jerome Conus24-Feb-03 5:06 
GeneralRe: Copy constructor Pin
Alvaro Mendez24-Feb-03 4:49
Alvaro Mendez24-Feb-03 4:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.