ShellExecute使用方法
A程序使用ShellExecute打开另一个程序B,并传参的过程中,如果B不关联dll则能正常打开并正常接收参数,如果关联dll则打开正常但无法接收参数。 不知为何?望知道的兄弟解答 谢谢!!
A中代码如下:
void CShexeDlg::OnButton1()
{
// TODO: Add your control notification handler code here
CString szPath = QueryExePath()+"aut.exe";
CString szStr=_T("0102001");
ShellExecute(NULL,"open",szPath,szStr,NULL,SW_SHOW);
}
CString CShexeDlg::QueryExePath()
{
TCHAR path[MAX_PATH];
::GetModuleFileName(NULL,path,MAX_PATH);
CString p(path);
CString subp;
int nPos = p.ReverseFind('\\');
return p.Left(nPos+1);
}
LPSTRlpsz=GetCommandLine();
theApp.str1=lpsz;