![[MFC] MFC 打开HTML资源(用ID版,也可加载到自己的web控件上) [MFC] MFC 打开HTML资源(用ID版,也可加载到自己的web控件上)](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
@ ^ @:如果是加载到web控件上,就把注释掉的解除注释(改为web控件点后面的函数),把下一句注释
BOOL Button::LoadFromResource(UINT nRes){//打开网页加载自己写的html文件 HINSTANCE hInstance = AfxGetResourceHandle();
ASSERT(hInstance != NULL);//确定有资源 CString strResourceURL;
BOOL bRetVal = TRUE;
LPTSTR lpszModule = new TCHAR[_MAX_PATH]; if (GetModuleFileName(hInstance, lpszModule, _MAX_PATH)){
strResourceURL.Format(_T("res://%s/%d"),lpszModule, nRes);
//Navigate(strResourceURL, 0, 0, 0);
ShellExecute(NULL,_T("open"),strResourceURL,NULL,NULL,SW_SHOWNORMAL);
}
else bRetVal = FALSE; delete [] lpszModule;
return bRetVal;
}