M
Maurice Hoeneveld
Hello
Let me first tell you that I am not a die-hard C programmer
I building a small C++ application that has to check the version of MS
Internet Explorer.
On MSDN at;
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/license/licensing.asp
I found the function as listed below.
I can compile the function as a DLL but I want to d the following;
My small program checks some system variables before a presentation
starts up and also has to check the version of shdocvw.dll
I want to put the function inside my program but I have no idea how to
use it.
Is there anyone who can give me a hint?
Any help is appreciated. Thanks for your time and help in advance.
Maurice Hoeneveld
Network Security Management
Facilitaire Dienst ICT Afdeling
Hogeschool Rotterdam
+31 (0)10 2414197
+31 (0)6 48133104
(e-mail address removed)
***** LISTING from MSDN
The following function retrieves the major and minor version numbers
of the
Shdocvw.dll that is installed on the local system.
#include <windows.h>
#include <shlwapi.h>
HRESULT GetBrowserVersion(LPDWORD pdwMajor, LPDWORD pdwMinor)
{
HINSTANCE hBrowser;
if( IsBadWritePtr(pdwMajor, sizeof(DWORD)) ||
IsBadWritePtr(pdwMinor, sizeof(DWORD)))
return E_INVALIDARG;
*pdwMajor = 0;
*pdwMinor = 0;
//Load the DLL.
hBrowser = LoadLibrary(TEXT("shdocvw.dll"));
if(hBrowser)
{
HRESULT hr = S_OK;
DLLGETVERSIONPROC pDllGetVersion;
/*
You must get this function explicitly.
*/
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
{
/*
If GetProcAddress failed, there is a problem with the DLL.
*/
hr = E_FAIL;
}
FreeLibrary(hBrowser);
return hr;
}
return E_FAIL;
}
Let me first tell you that I am not a die-hard C programmer
I building a small C++ application that has to check the version of MS
Internet Explorer.
On MSDN at;
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/license/licensing.asp
I found the function as listed below.
I can compile the function as a DLL but I want to d the following;
My small program checks some system variables before a presentation
starts up and also has to check the version of shdocvw.dll
I want to put the function inside my program but I have no idea how to
use it.
Is there anyone who can give me a hint?
Any help is appreciated. Thanks for your time and help in advance.
Maurice Hoeneveld
Network Security Management
Facilitaire Dienst ICT Afdeling
Hogeschool Rotterdam
+31 (0)10 2414197
+31 (0)6 48133104
(e-mail address removed)
***** LISTING from MSDN
The following function retrieves the major and minor version numbers
of the
Shdocvw.dll that is installed on the local system.
#include <windows.h>
#include <shlwapi.h>
HRESULT GetBrowserVersion(LPDWORD pdwMajor, LPDWORD pdwMinor)
{
HINSTANCE hBrowser;
if( IsBadWritePtr(pdwMajor, sizeof(DWORD)) ||
IsBadWritePtr(pdwMinor, sizeof(DWORD)))
return E_INVALIDARG;
*pdwMajor = 0;
*pdwMinor = 0;
//Load the DLL.
hBrowser = LoadLibrary(TEXT("shdocvw.dll"));
if(hBrowser)
{
HRESULT hr = S_OK;
DLLGETVERSIONPROC pDllGetVersion;
/*
You must get this function explicitly.
*/
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
{
/*
If GetProcAddress failed, there is a problem with the DLL.
*/
hr = E_FAIL;
}
FreeLibrary(hBrowser);
return hr;
}
return E_FAIL;
}