Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Get Version of Internet Explorer from Shdocvw.dll

Posted on 1999-07-07
3
Medium Priority
?
360 Views
Last Modified: 2010-04-16
I am working on writing a function that is capable of detecting the version of Internet Explorer that is installed.  I have already written one that retrives the information from the HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer registry key.  That was fairly easy.  Now I would like to take on a considerably more difficult and more accurate approach to resolve the same problem, obtaining the information directly from shdocvw.dll located in the system directory.

I know that I need to use GetSystemDirectory ( , ) to obtain the system directory information.  Then I need to determine if shdocvw.dll exists in the system directory.  I believe that I can accomplish this by creating a _finddata_t structure using _findfirst to find the file.  If _findfirst fails, I know that IE is not installed.

My questions begin with what comes next.  I have read the documentation on the GetFileVersionInfo ( , , , ) function that is available in the MSDN library and find it to be confusing at best.  I also am disappointed by the lack of example code for the GetFileVersionInfo API.  Since I want my function to be usable in Windows 95 on up, I know that I cannot use the simpler DllGetVersion function.

Does anyone have some example code on how to use the GetFileVersionInfo ( , , , ) function or some code illustrating how to accomplish the goal of obtaining the Internet Explorer version shdocvw.dll?  Even just clarification on how to use the GetFileVersionInfo ( , , , ) function will be helpfull.
0
Comment
Question by:Bkey1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
snoegler earned 600 total points
ID: 1199441
Hello Bkey1,

I've been using the function below for a similar task.
It takes the name of the DLL (located in the system directory) and returns the version number in 'v1','v2','v3','v4'.

/*-----------------------------------------------------------------------------
**  FUNCTION:   GetVersionInfo()
**  RETURNS:    <bool>
**  PURPOSE:    Returns the version no. of 'shdocvw.dll'
-----------------------------------------------------------------------------*/
bool    GetVersionInfo(LPCTSTR lpszDLL, int& v1,int& v2,int& v3,int& v4)
{
    char            szBuffer[_MAX_PATH];
    char            szTemp[_MAX_PATH];
    GetSystemDirectory(szBuffer,_MAX_PATH);

    v1=v2=v3=v4=-1;

    sprintf(szTemp,"%s\\%s",szBuffer,lpszDLL);
    DWORD           dwZero,dwSize;
    dwSize          =GetFileVersionInfoSize(szTemp,&dwZero);
    if(dwSize==0)
        return false;

    unsigned char   *pvdata=new unsigned char[dwSize];
    if(GetFileVersionInfo(szTemp,NULL,dwSize,pvdata)==FALSE) {
        delete pvdata;
        return false;
    }

    VS_FIXEDFILEINFO *pvfi;
    UINT            nVerLen;

    if(VerQueryValue(pvdata,"\\",(LPVOID*)&pvfi,&nVerLen)==FALSE) {
        delete pvdata;
        return false;
    }

    v1              =HIWORD(pvfi->dwFileVersionMS);
    v2              =LOWORD(pvfi->dwFileVersionMS);
    v3              =HIWORD(pvfi->dwFileVersionLS);
    v4              =LOWORD(pvfi->dwFileVersionLS);

    delete pvdata;

    return true;
}

Hope that helped,
snoegler

0
 

Author Comment

by:Bkey1
ID: 1199442
This helps alot.  Thank you very much.  I am especially glad that this function does not require MFC, it can be used in an application based on the Win32 API.  I am also pleased to see that it is well organized, easily understood code.
0
 
LVL 6

Expert Comment

by:snoegler
ID: 1199443
Thanks :)
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question