Home > Back-end >  ShellExecute incoming parameters and call the exe, but an error in the InitInstance
ShellExecute incoming parameters and call the exe, but an error in the InitInstance

Time:09-26

Requirements are dynamic invocation ocx interface, use the ShellExecute () method will be introduced to the user name password incoming, the InitInstance () receive and complete the login and initialize window, the code is as follows:

InitInstance ()
{
LPWSTR * szArglist=NULL;
Int nArgs=0, uintPort;
Cstrings strUser, strPwd strAddress;
SzArglist=CommandLineToArgvW (GetCommandLineW (), & amp; NArgs);
//get the user name password and other information
If (NULL!=szArglist & amp; & NArgs & gt;
=2){
IsLoginDialog=false;
Int intArgs=nArgs;
Cstrings strPara=szArglist [1].
Char sentence [128].
Strcpy (sentence, strPara GetBuffer (strPara GetLength ()));
Char * PtrUser=strtok (sentence, ", ");
Char * PtrPwd=strtok (NULL, ", ");
StrUser. The Format (" % s ", PtrUser);
StrPwd. The Format (" % s ", PtrPwd);
Char szProfile [128].
Memset (szProfile, 0, sizeof (szProfile));
GetPrivateProfileString (" Server ", "Address", "127.0.0.1," szProfile, 20, INI_FILE);
StrAddress=szProfile;
UintPort=GetPrivateProfileInt (" Server "and" Port ", 30000, INI_FILE);
}
//in this login
Logon (APPSYSMANAGER, 1, NULL, "the operator name," strAddress, uintPort, strUser, strPwd);
//the following error, solving the why...
CCommandLineInfo cmdInfo;
ParseCommandLine (cmdInfo);
//Dispatch commands specified on the command line
if (! ProcessShellCommand (cmdInfo))
return FALSE;

//The main window has had been initialized, so show and update it.
M_pMainWnd - & gt; CenterWindow ();
M_pMainWnd - & gt; ShowWindow (SW_MAXIMIZE);
M_pMainWnd - & gt; SetWindowText (" management subsystem ");
M_pMainWnd - & gt; UpdateWindow ();
return TRUE;
}

CodePudding user response:

Error message is: C: \ Users \ user \ Desktop \ Admin, 888888 was not found.
Admin and 888888 is my incoming parameters in InitInstance () parsing out respectively and then login, but in
CCommandLineInfo cmdInfo;
ParseCommandLine (cmdInfo);
if (! ProcessShellCommand (cmdInfo))
return FALSE;
Center daily news the fault, a great god,,,

CodePudding user response:

Ok, knot posted, is actually very simple, the if (! ProcessShellCommand (cmdInfo) commented out is ok, it's only a check check command line information, comments the window will open, will not affect the program running state,
  • Related