使用ShellExecute函数打开IE浏览器下的新窗口

来源:互联网 发布:php 单例模式 编辑:程序博客网 时间:2024/06/06 02:01
HWND OpenWindows(HWND hwnd)
{
LPCTSTR  open = L"open";      //set config
//ShellExecute(hwnd, open, L"iexplore.exe", L"https://hao.360.cn/?a1004", NULL, SW_SHOWNORMAL);
//ShellExecute(hwnd, open, L"http://www.2cto.com/kf/201307/229105.html",NULL, NULL, SW_SHOWNORMAL);


ShellExecute(hwnd,  open,L"C:\\Program Files\\Internet Explorer\\iexplore.exe", NULL, NULL, SW_SHOWMAXIMIZED );//open the first ie explore.
Sleep(500);
HWND hwexp1 = FindWindow(L"IEFrame",NULL); //get the hwnd
for(int i=0;i<5;i++)
ShellExecute(hwexp1, open, L"https://hao.360.cn/?a1004", NULL, NULL, SW_SHOWMAXIMIZED);//get 5 page from the first ie windows.
Sleep(1500);
ShellExecute(hwnd,  open,L"C:\\Program Files\\Internet Explorer\\iexplore.exe", NULL, NULL, SW_SHOWMAXIMIZED );//open the 2nd ie explore.
Sleep(500);
HWND hwexp2 = FindWindow(L"IEFrame",NULL); 
for(int i=0;i<5;i++)
ShellExecute(hwexp2, open, L"https://hao.360.cn/?a1004", NULL, NULL, SW_SHOWMAXIMIZED);//get 5 page from the 2nd ie windows.
return hwexp2;
}
原创粉丝点击