C++用ShellExecute打开IE

来源:互联网 发布:手机评测软件 编辑:程序博客网 时间:2024/06/04 22:24
#include <Windows.h>#include <stdio.h>#define IE L"iexplore.exe"#define URL L"http://www.baidu.com/"int main(){HINSTANCE hInstance;hInstance = ShellExecute(NULL, L"open", URL, NULL, NULL, SW_HIDE);//hInstance = ShellExecute(NULL, L"open", IE, URL, NULL, SW_HIDE);if (!hInstance) {wprintf(L"ShellExecute error:%d\n", GetLastError());return 0;}CloseHandle(hInstance);return 0;}

如果装了360和迅雷,用注释掉的那一行运行,则可能出现警报。