我调用
if( !CreateProcess( TEXT(test.exe), TEXT("4"), NULL,NULL,FALSE,0,NULL,NULL,&si,&pi ))
往test.exe中传入参数4,我怎么在test.exe中获取到4?
该test.exe是win32 application.
开始的函数为:
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)我试了输出lpCmdLine,都是为空!
if( !CreateProcess( TEXT(test.exe), TEXT("4"), NULL,NULL,FALSE,0,NULL,NULL,&si,&pi ))
往test.exe中传入参数4,我怎么在test.exe中获取到4?
该test.exe是win32 application.
开始的函数为:
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)我试了输出lpCmdLine,都是为空!
解决方案 »
- 窗口设置NULL_BRUSH,Invalidate+UpdateWindow无法擦除画上的图形
- std::string 与 using namespace std;性能问题
- GDI+图形界面刷新问题
- SHSQL.DLL 必须得文件不能装载 请重新安装Visual C++
- 想问一下,EVC++ 里面的ComBo Box控件怎么设置它的显示内容
- 打开.dll文件的问题
- 功能强大的全免费的手机短信控件
- 一个关于MCI很奇怪的问题~~~~高手帮忙~~~
- 请问怎样根据一张jpg图像得到压缩的量化表,菜鸟真心求解答
- FindWindow查找窗体句柄的时候为空
- 线程模型匹配是什么意思?
- 关于界面刷新的问题,请大家来帮我看看
strcpy(strcommandline,GetCommandLine( ));
//然后自己解析strcommandline,可以使用CCommandLineInfo
STARTUPINFO si = {sizeof(si)};
SECURITY_ATTRIBUTES saProcess,saThread;
char szPath[256]={0};
saProcess.nLength = sizeof(saProcess);
saProcess.lpSecurityDescriptor = NULL;
saProcess.bInheritHandle = TRUE;saThread.nLength = sizeof(saThread);
saThread.lpSecurityDescriptor = NULL;
saThread.bInheritHandle = FALSE;strcpy(szPath,"test.exe /4");
PROCESS_INFORMATION piProcess;
CreateProcess(NULL,szPath,&saProcess,&saThread,FALSE,0,NULL,NULL,&si,&piProcess);
1)使用GetCommandLine
2)然后使用CString类来操作就可以了
test.exe /4
两种都起不了test.exe.
用GetCommandLine()
也获取不到,请大家继续,有没有验证通过的?
我看看!