0
通過ShellExecuteEx()從我的MFC應用程序調用控制檯應用程序。 exe得到加載後,我想收到一個測試字符串窗體控制檯apllication到MFC,如果我不能接收字符串,然後我將關閉MFC和控制檯應用程序。從控制檯應用程序發送字符串到MFC
爲此,我想從控制檯應用程序發送任何字符串或值到MFC。 我不知道該怎麼做。
char szFile[20]={0},szDir[500]={0};
memset(szFile,0,20);
memset(szDir,0,500);
strcpy(szFile,szModelName);
strcat(szFile,".EXE");
sInfo.lpFile = szFile;
sInfo.hwnd = NULL;//this;
sInfo.lpParameters ="MODEL";
strcat(szDir,"\\Sources\\");
sInfo.lpDirectory = szDir;
sInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
sInfo.cbSize = sizeof(SHELLEXECUTEINFO);
sInfo.lpVerb = "open";
sInfo.nShow = SW_HIDE;
sInfo.hwnd = NULL;
BOOL bFlag = ShellExecuteEx(&sInfo);
控制檯應用程序編碼
int main(int argc , char *argv[])
{ char str[50];
strcpy(str,argv[1]);
getch();
}