#include <windows.h>
#include <urlmon.h>
#include <mshtmhst.h>
/**************************************************************************
WinMain()
**************************************************************************/
int PASCAL WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HINSTANCE hinstMSHTML = LoadLibrary(TEXT("MSHTML.DLL")); //装载动态连接库
WCHAR url[]=L"http://blog.csdn.net/zlyperson";//此地址名称可直接用html文件名代替
if(hinstMSHTML)//装载动态连接库成功
{
SHOWHTMLDIALOGFN *pfnShowHTMLDialog;
pfnShowHTMLDialog = (SHOWHTMLDIALOGFN*)GetProcAddress(hinstMSHTML, TEXT("ShowHTMLDialog"));
if(pfnShowHTMLDialog)
{
IMoniker *moniker=NULL;
//
if( FAILED(CreateURLMoniker(NULL, (LPWSTR)url,&moniker ) ))
{
FreeLibrary(hinstMSHTML);
return 0;
}
VARIANT varArgs;
VARIANT varOut;
VariantInit(&varOut);
varArgs.vt = VT_BSTR;
varArgs.bstrVal = SysAllocString(L"RookIE Browser");
TCHAR *tcFeatures = "dialogWidth:100px;dialogHeight:100px;dialogLeft:0px;dialogTop:0px;";
pfnShowHTMLDialog(NULL, moniker, &varArgs, tcFeatures, &varOut);
VariantClear(&varArgs);
if(moniker != NULL)
moniker->Release();
//显示成功,返回TRUE
return 0;
}
else //GetProcessAddress失败
return 0;
FreeLibrary(hinstMSHTML);
}
else //装载动态连接库失败
return 0;
return 0;
}
本文地址:http://com.8s8s.com/it/it24531.htm