[MFC] MFC 打开HTML资源(用ID版,也可加载到自己的web控件上)

@ ^ @:如果是加载到web控件上,就把注释掉的解除注释(改为web控件点后面的函数),把下一句注释

 1 BOOL Button::LoadFromResource(UINT nRes){//打开网页加载自己写的html文件
 2 
 3     HINSTANCE hInstance = AfxGetResourceHandle();
 4     ASSERT(hInstance != NULL);//确定有资源
 5 
 6     CString strResourceURL;
 7     BOOL bRetVal = TRUE;
 8     LPTSTR lpszModule = new TCHAR[_MAX_PATH];
 9 
10     if (GetModuleFileName(hInstance, lpszModule, _MAX_PATH)){
11         strResourceURL.Format(_T("res://%s/%d"),lpszModule, nRes);
12         //Navigate(strResourceURL, 0, 0, 0);
13         ShellExecute(NULL,_T("open"),strResourceURL,NULL,NULL,SW_SHOWNORMAL);
14     }
15     else bRetVal = FALSE;
16 
17     delete [] lpszModule;
18     return bRetVal;
19 }

 

posted @ 2014-03-02 23:49  beautifulzzzz  阅读(2444)  评论(0编辑  收藏  举报