Created
May 27, 2017 08:57
-
-
Save z4none/4ebe9c0c22ddc357283a275618c8d2d0 to your computer and use it in GitHub Desktop.
ShowHTMLDialog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "stdafx.h" | |
| #include <urlmon.h> | |
| #pragma comment(lib, "urlmon.lib") | |
| typedef HRESULT STDAPICALLTYPE MYSHOWHTMLDIALOGFN(HWND hwndParent, IMoniker * pmk, VARIANT * pvarArgIn, TCHAR * pchOptions, VARIANT * pvArgOut); | |
| // | |
| int APIENTRY WinMain(HINSTANCE hInstance, | |
| HINSTANCE hPrevInstance, | |
| LPSTR lpCmdLine, | |
| int nCmdShow) | |
| { | |
| MYSHOWHTMLDIALOGFN* funcShowHTMLDialog; | |
| HINSTANCE hLib = ::LoadLibraryA("mshtml.dll"); | |
| if (hLib != INVALID_HANDLE_VALUE) | |
| { | |
| funcShowHTMLDialog = (MYSHOWHTMLDIALOGFN*)::GetProcAddress(hLib, "ShowHTMLDialog"); | |
| if (funcShowHTMLDialog) | |
| { | |
| LPCWSTR str = L"http://www.baidu.com"; | |
| IMoniker * pmoniker = NULL; | |
| if (SUCCEEDED(::CreateURLMoniker(NULL, str, &pmoniker))) | |
| { | |
| TCHAR * pOptions = (TCHAR*)L"dialogHeight:600px;dialogWidth:800px;help:no;status:no;scroll:no"; | |
| funcShowHTMLDialog(NULL, pmoniker, NULL, pOptions, NULL); | |
| } | |
| else | |
| MessageBoxA(NULL, "CreateURLMoniker fails", "Error..", MB_OK); | |
| } | |
| else | |
| MessageBoxA(NULL, "GetProcAddress fails", "Error..", MB_OK); | |
| ::FreeLibrary(hLib); | |
| } | |
| else | |
| MessageBoxA(NULL, "LoadLibrary fails", "Error..", MB_OK); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment