Home > Software engineering >  AfxGetApp () -> m_lpCmdLine, contains whitespace, display incomplete
AfxGetApp () -> m_lpCmdLine, contains whitespace, display incomplete

Time:11-10

File types and procedures have been associated, can launch software and load the file by double-clicking on the file, in the program through the
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 Spaces

CodePudding user response:

Registered in the command parameters quotes "% 1"

CodePudding user response:

At the command line, the blank space is parameter boundary
Such 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 see

CodePudding user response:

//to write registry registration information
CGCFileTypeAccess 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 ();
  • Related