如何运行一个可执行文件?

KiGhost 2004-07-31 05:16:57
请问在MFC中如何运行一个可执行文件?.exe
...全文
120 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
KiGhost 2004-08-05
  • 打赏
  • 举报
回复
理由是什么楼上可不可以给个例子》??》???
hopen 2004-07-31
  • 打赏
  • 举报
回复
少用WinExec多用CreateProcess,核心编程说的,我觉得挺有道理
kvw3000 2004-07-31
  • 打赏
  • 举报
回复
不好意思,没排好版,好好看,应该可以看明白
kvw3000 2004-07-31
  • 打赏
  • 举报
回复
打开当前目录下的LiveUpdate.exe,含错误处理:
HINSTANCE hInstance = ShellExecute(NULL, "open", "LiveUpdate.exe", NULL, NULL, SW_SHOWNORMAL);
switch((long)hInstance)
{
case ERROR_FILE_NOT_FOUND:
case ERROR_PATH_NOT_FOUND:
::MessageBox(m_hWnd, "Cannot find LiveUpdate.exe, please reinstall the program, Update terminate.", TEXT("ChatE"), MB_OK|MB_ICONSTOP);
break;
case ERROR_BAD_FORMAT:
::MessageBox(m_hWnd, "LiveUpdate.exe may be corrupt, please reinstall the program, Update terminate.", TEXT("ChatE"), MB_OK|MB_ICONSTOP);
break;
case SE_ERR_OOM:
case 0:
::MessageBox(m_hWnd, "Run program error, out of memory, Update terminate.", TEXT("ChatE"), MB_OK|MB_ICONSTOP);
break;
default:
bHaveError = FALSE;
break;
}
RockHwnd 2004-07-31
  • 打赏
  • 举报
回复
.......送分贴啊,我来晚了
windyloft 2004-07-31
  • 打赏
  • 举报
回复
BOOL ShellExecuteEx(
LPSHELLEXECUTEINFO lpExecInfo
);

Parameters
lpExecInfo
Address of a SHELLEXECUTEINFO structure that contains and receives information about the application being executed.
Return Values
Returns TRUE if successful, or FALSE otherwise. Call GetLastError for error information.

aspnetwuxueyou 2004-07-31
  • 打赏
  • 举报
回复
CreateProcess
louifox 2004-07-31
  • 打赏
  • 举报
回复
UINT WinExec(
LPCSTR lpCmdLine, // command line
UINT uCmdShow // window style
);
MSDN讲的很明白啊
KiGhost 2004-07-31
  • 打赏
  • 举报
回复
请问具体用法是怎么样的》》
louifox 2004-07-31
  • 打赏
  • 举报
回复
WinExec

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧