passing an argument to an executable file
-
Just an inquiry... How do I implement my program so that if I made it an executable file, it's possible to pass "arguments/parameters" to the executable file when it is called... i.e. if I made my BOOk Program as an executable file and I want my executable file of the Book program to accept video file parameters, how do I do this? In analogy, if i want to open the realplayer.Exe, i command a SHELLEXECUTE with the *.rm file as paramenter and the realplayer automatically opens it. Thanks in Advance. Best Wishes to all.
-
Just an inquiry... How do I implement my program so that if I made it an executable file, it's possible to pass "arguments/parameters" to the executable file when it is called... i.e. if I made my BOOk Program as an executable file and I want my executable file of the Book program to accept video file parameters, how do I do this? In analogy, if i want to open the realplayer.Exe, i command a SHELLEXECUTE with the *.rm file as paramenter and the realplayer automatically opens it. Thanks in Advance. Best Wishes to all.
pass the parameters on the command line: c:\> MyApp.EXE file.ext in your app, use one of the many command line parsers available here to grab the parameters and act accordingly. -c
-
pass the parameters on the command line: c:\> MyApp.EXE file.ext in your app, use one of the many command line parsers available here to grab the parameters and act accordingly. -c
Sorry, u might have misunderstood my question 'cuz it seems a little bit confusing... to clarify: I'll set an example. I have two programs: "X" and "Y" program. -I programmed X to process video files. then convert it to executable file -I have another program Y which calls this executable file of X (X.exe) with a VIDEO FILE parameter possibly using the command ShellExecute (hwnd, "open", "X.exe", [Video File PathName], [Directory of Executable File], SW_SHOWNORMAL); so the question is, how do i Program X so that it can accept the VIDEO FILE parameter of Y. and open it afterwards. Y ---video file ---> X.exe Thanks in Advance... :)
-
Just an inquiry... How do I implement my program so that if I made it an executable file, it's possible to pass "arguments/parameters" to the executable file when it is called... i.e. if I made my BOOk Program as an executable file and I want my executable file of the Book program to accept video file parameters, how do I do this? In analogy, if i want to open the realplayer.Exe, i command a SHELLEXECUTE with the *.rm file as paramenter and the realplayer automatically opens it. Thanks in Advance. Best Wishes to all.
The command line parameters can be used in the InitInstance() of your application. The command line is stored in m_lpCmdLine which is a char array. If you pass your parameter with a slash (ie. /MYPARM) they will be considered flags. If you don't include the slash the first parameter will be considered to be the file you want to open. You can turn off that behavior my setting: cmdIndo.mShellCommand = CCommandLineInfo::FileNew; but why not just include the slash? *NOTE you can test your command line parameter in the developer studio! see the PROJECT - SETTINGS - DEBUG(tab) I usually deal with the command line in my applications InitInstance() just before: // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo);
-
The command line parameters can be used in the InitInstance() of your application. The command line is stored in m_lpCmdLine which is a char array. If you pass your parameter with a slash (ie. /MYPARM) they will be considered flags. If you don't include the slash the first parameter will be considered to be the file you want to open. You can turn off that behavior my setting: cmdIndo.mShellCommand = CCommandLineInfo::FileNew; but why not just include the slash? *NOTE you can test your command line parameter in the developer studio! see the PROJECT - SETTINGS - DEBUG(tab) I usually deal with the command line in my applications InitInstance() just before: // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo);