Click here to Skip to main content
16,005,473 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Recycle bin API restore all files API Pin
David Crow22-Aug-03 2:58
David Crow22-Aug-03 2:58 
GeneralSimple Problem VC++6 Pin
questaware21-Aug-03 19:01
questaware21-Aug-03 19:01 
GeneralRe: Simple Problem VC++6 Pin
Member 34642221-Aug-03 19:05
Member 34642221-Aug-03 19:05 
GeneralRe: Simple Problem VC++6 Pin
Michael Dunn21-Aug-03 19:45
sitebuilderMichael Dunn21-Aug-03 19:45 
Generalsizeof() problem Pin
IceBerG7121-Aug-03 17:49
IceBerG7121-Aug-03 17:49 
GeneralRe: sizeof() problem Pin
Brad Sokol21-Aug-03 18:06
Brad Sokol21-Aug-03 18:06 
GeneralRe: sizeof() problem Pin
IceBerG7121-Aug-03 18:58
IceBerG7121-Aug-03 18:58 
GeneralNeed some help with CreateProcess() Pin
Flack21-Aug-03 17:22
Flack21-Aug-03 17:22 
Hello,

I have a question on how command line args work with CreateProcess.

Lets say I want to open a specific Word document. I set a string, program, to

program = " \"C:\\Program Files\\Microsoft Office\\Office10\\WINWORD.EXE\" \"C:\\Docs\\Open This File.doc\" ";

Then I do:
<br />
if( !CreateProcess( <br />
NULL                                       // No module name (use command line).  <br />
program.GetBuffer(0),                      // Command line.<br />
NULL,                                      // Process handle not inheritable. <br />
NULL,                                      // Thread handle not inheritable. <br />
FALSE,                                     // Set handle inheritance to FALSE. <br />
0,                                         // No creation flags. <br />
NULL,                                      // Use parent's environment block. <br />
workingDirectory,                          // Use parent's starting directory. <br />
&si,                                       // Pointer to STARTUPINFO structure.<br />
&pi)                                       // Pointer to PROCESS_INFORMATION structure.<br />
) <br />


where working directory is correctly set.

Now, this runs Word fine and opens the doc.

However, I tried to run another file, a game (C&C Generals).
I wanted the game to run with the flags -quickstart -xres 1280 -yres 1040.
So, I set program:

program = " \"C:\\Games\\C&C Generals\\Generals.exe\" \"-quickstart -xres 1280 -yres 1040\" ";

and did the same thing with CreateProcess. But now, the args are ignored.

I tried to fix it and what worked was when I got rid of the quotes around
-quickstart -xres 1280 -yres 1040 and then it worked fine.

If I get rid of the quotes around C:\Docs\Open This File.doc then Word doesnt open the file correctly.

So, here is my question:
When do I need to use quotes around the arguments? Do I only use quotes if the arg is another file and not when they are flags for the executable?

If my question is not clear, please let me know.

Thanx for the help,
-Flack
GeneralRe: Need some help with CreateProcess() Pin
Brad Sokol21-Aug-03 17:31
Brad Sokol21-Aug-03 17:31 
QuestionNeed I define a function as &quot;extern&quot;? Pin
George221-Aug-03 15:46
George221-Aug-03 15:46 
AnswerRe: Need I define a function as &quot;extern&quot;? Pin
Brad Sokol21-Aug-03 16:54
Brad Sokol21-Aug-03 16:54 
GeneralRe: Need I define a function as &quot;extern&quot;? Pin
George221-Aug-03 23:28
George221-Aug-03 23:28 
GeneralRe: Need I define a function as &quot;extern&quot;? Pin
Brad Sokol22-Aug-03 1:52
Brad Sokol22-Aug-03 1:52 
GeneralRe: Need I define a function as &quot;extern&quot;? Pin
George222-Aug-03 2:10
George222-Aug-03 2:10 
AnswerRe: Need I define a function as &quot;extern&quot;? Pin
Maxwell Chen21-Aug-03 20:09
Maxwell Chen21-Aug-03 20:09 
GeneralRe: Need I define a function as &quot;extern&quot;? Pin
George221-Aug-03 23:24
George221-Aug-03 23:24 
GeneralRe: Need I define a function as &quot;extern&quot;? Pin
Dangleberry22-Aug-03 4:09
sussDangleberry22-Aug-03 4:09 
GeneralRe: Need I define a function as &quot;extern&quot;? Pin
George224-Aug-03 0:47
George224-Aug-03 0:47 
General3D layer visualization Pin
coda_x21-Aug-03 15:29
coda_x21-Aug-03 15:29 
GeneralRead DLL source code Pin
wow999921-Aug-03 15:24
wow999921-Aug-03 15:24 
GeneralRe: Read DLL source code Pin
Brad Sokol21-Aug-03 16:18
Brad Sokol21-Aug-03 16:18 
GeneralRe: Read DLL source code Pin
Ryan Binns21-Aug-03 16:31
Ryan Binns21-Aug-03 16:31 
QuestionWhat project type to choose to run on all windows Pin
Chris Ormerod21-Aug-03 14:23
Chris Ormerod21-Aug-03 14:23 
AnswerRe: What project type to choose to run on all windows Pin
David Crow22-Aug-03 3:19
David Crow22-Aug-03 3:19 
Questionaccess JS vars on page in web browser control? Pin
Scott H. Settlemier21-Aug-03 11:59
Scott H. Settlemier21-Aug-03 11:59 

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.