shellexecute

shellexecute怎么使用

小亿
109
2023-08-29 19:41:09
栏目: 编程语言

ShellExecute是一个Windows API函数,用于执行外部程序或打开文件。下面是ShellExecute函数的使用方式:

  1. 首先,包含Windows.h头文件。
#include <Windows.h>
  1. 调用ShellExecute函数来执行外部程序或打开文件。函数的原型如下:
HINSTANCE ShellExecute(
HWND    hwnd,
LPCTSTR lpOperation,
LPCTSTR lpFile,
LPCTSTR lpParameters,
LPCTSTR lpDirectory,
INT     nShowCmd
);

参数说明:

示例代码:

ShellExecute(NULL, _T("open"), _T("C:\\Windows\\notepad.exe"), NULL, NULL, SW_SHOWNORMAL);

上面的代码会打开Windows记事本程序。

注意:

0
看了该问题的人还看了