AfxGetApp () - & gt; M_lpCmdLine
Gain parameters (file path), path shows that incomplete path contains Spaces, space parts show ~ 1, some computers can normal load, some computers can't, don't know and what about, or how to get the complete path, please check it out!
CodePudding user response:
Quotes when the path contains SpacesCodePudding user response:
Registered in the command parameters quotes "% 1"CodePudding user response:
At the command line, the blank space is parameter boundarySuch as aa. Exe a to b, he has two parameters, respectively is a and b, rather than a b the string
Such as parameter Spaces, need quotes wrapped up, such as aa. Exe "b", so that only one parameter
CodePudding user response:
As you registered file types related code to seeCodePudding user response:
//to write registry registration informationCGCFileTypeAccess TheFTA;
TCHAR szProgPath [_MAX_PATH];
GetModuleFileName (NULL, szProgPath, _MAX_PATH);
CsOpenCommand=szProgPath;
CsOpenCommand +=_T (" \ "% 1 " ");
TheFTA. SetRegistryValue (HKEY_CLASSES_ROOT, _T (" XXX "), _T (" "), _T (" XXX, XXX "));
TheFTA. SetRegistryValue (HKEY_CLASSES_ROOT, _T (" XXX, XXX "), _T (" "), _T (" XXX parameters "));
TheFTA. SetRegistryValue (HKEY_CLASSES_ROOT, _T (XXX. XXX \ \ shell \ \ "open \ \ command"), _T (" "), csOpenCommand);
CodePudding user response:
Available at any time of the standard library __argc __argv
#include
#include
Void Test ()
{
For (int n=0; n<__argc; N++)
{
_tprintf (TEXT (" arg % d=% s \ n "), n, __targv [n]);
}
}
CodePudding user response:
CCommandLineInfo: : ParseParam ();