CSDN博客

img auding1900

一个得到浏览器(IE)版本的函数

发表于2004/9/20 19:46:00  772人阅读

分类: 编程学习日记

HRESULT CCGAEditorApp::GetBrowserVersion(LPDWORD pdwMajor, LPDWORD pdwMinor)
{
 HINSTANCE   hBrowser;
 if(IsBadWritePtr(pdwMajor, sizeof(DWORD)) ||
  IsBadWritePtr(pdwMinor, sizeof(DWORD)))
  return E_INVALIDARG;
 
 *pdwMajor = 0;
 *pdwMinor = 0;
 
 hBrowser = LoadLibrary(TEXT("shdocvw.dll"));
 
 if(hBrowser)
 {
  HRESULT           hr = S_OK;
  DLLGETVERSIONPROC pDllGetVersion;
  
  pDllGetVersion = (DLLGETVERSIONPROC)GetProcAddress(hBrowser, TEXT("DllGetVersion"));
  
  if(pDllGetVersion)
  {
   DLLVERSIONINFO    dvi;
   ZeroMemory(&dvi, sizeof(dvi));
   dvi.cbSize = sizeof(dvi);
   hr = (*pDllGetVersion)(&dvi);
   if(SUCCEEDED(hr))
   {
    *pdwMajor = dvi.dwMajorVersion;
    *pdwMinor = dvi.dwMinorVersion;
   }
  }
  else
  {
   hr = E_FAIL;
  }
  FreeLibrary(hBrowser);
  return hr;
 }
 return E_FAIL;
}
0 0

相关博文

我的热门文章

img
取 消
img