在使用ShellExecute来启动一个新程序并要给程序传递参数时,直接写参数,发现执行时,总是出现ERROR_FILE_NOT_FOUND, 很让人疑惑。后来,就按照MSDN中的ShellExecute的API说明,使用char型或TCHAR型参数,在ShellExecute就可以正常启动程序了。而使用CString类作为参数传递,也不能正常启动程序。
MSDN 中ShellExecute的原型:
HINSTANCE ShellExecute(
HWND hwnd,
LPCTSTR lpOperation,
LPCTSTR lpFile,
LPCTSTR lpParameters,
LPCTSTR lpDirectory,
INT nShowCmd
);
在MSDN中,有一篇文章说ShellExecute的,http://support.microsoft.com/?kbid=837633,“Errors in Windows XP applications that start by using the ShellExecute() ”.
博客讲述使用ShellExecute启动新程序并传递参数时,直接写参数会出现ERROR_FILE_NOT_FOUND错误。按照MSDN中ShellExecute的API说明,使用char型或TCHAR型参数可正常启动,而使用CString类作为参数则不能正常启动,还给出了相关MSDN文章链接。
433

被折叠的 条评论
为什么被折叠?



