MFC 打开网页的模态窗口
2012-07-31 10:46 hoho_luo 阅读(273) 评论(0) 编辑 收藏 举报typedef HRESULT STDAPICALLTYPE SHOWHTMLDIALOGFN(HWND hwndParent, IMoniker *pMk, VARIANT *pvarArgIn, WCHAR *pchOptions, VARIANT *pvarArgOut );
HINSTANCE hinstMSHTML = LoadLibrary(TEXT( "MSHTML.DLL ")); if (hinstMSHTML == NULL) { // Error loading module -- fail as securely as possible return; } SHOWHTMLDIALOGFN* pfnShowHTMLDialog; pfnShowHTMLDialog = (SHOWHTMLDIALOGFN*)GetProcAddress(hinstMSHTML, "ShowHTMLDialog"); if (pfnShowHTMLDialog) { IMoniker *pURLMoniker; BSTR bstrURL = SysAllocString(_T("http://www.csdn.net")); CreateURLMoniker(NULL, bstrURL, &pURLMoniker); if (pURLMoniker) { (*pfnShowHTMLDialog)(NULL,pURLMoniker,NULL,_T("dialogHeight:700px; dialogWidth:500px;edge:sunken;center:Yes;help:no;resizable:Yes;status:Yes;"),NULL); pURLMoniker-> Release(); } SysFreeString(bstrURL);
}
FreeLibrary(hinstMSHTML);