Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 从Win32应用程序启动外部可执行文件时出现问题_Visual Studio_Winapi_Mfc_Shellexecute - Fatal编程技术网

Visual studio 从Win32应用程序启动外部可执行文件时出现问题

Visual studio 从Win32应用程序启动外部可执行文件时出现问题,visual-studio,winapi,mfc,shellexecute,Visual Studio,Winapi,Mfc,Shellexecute,我试图从Win32应用程序中启动外部应用程序,但失败了。以下是我正在使用的代码: HINSTANCE instance = ShellExecute(NULL, _T("open"), _T("loader.exe"), NULL, NULL, SW_SHOWNORMAL); if((int)instance <= 32) { _cprintf("Error = 0x%X\n", GetLastError()); return 0; } HINSTANCE instanc

我试图从Win32应用程序中启动外部应用程序,但失败了。以下是我正在使用的代码:

HINSTANCE instance = ShellExecute(NULL, _T("open"), _T("loader.exe"), NULL, NULL, SW_SHOWNORMAL);
if((int)instance <= 32)
{
    _cprintf("Error = 0x%X\n", GetLastError());
    return 0;
}
HINSTANCE instance=ShellExecute(NULL、_T(“open”)、_T(“loader.exe”)、NULL、NULL、SW\u SHOWNORMAL);
如果((int)实例良好,则返回错误0x2

看起来它找不到“loader.exe”

错误2是“找不到文件”:


我猜它找不到loader.exe。

将loader.exe放在搜索路径中的某个位置,或提供完整路径。这就是如何避免此文件未找到错误的方法。Windows错误代码都记录在MSDN上。

是否确定loader.exe与应用程序可执行文件位于同一路径(应用程序可执行文件的路径不是项目或源代码文件的路径-它必须是bin/Debug或Release,具体取决于您的配置)