Solved

wrong comctl32.dll version

Posted on 1998-11-25
3
312 Views
Last Modified: 2013-11-20
I have an MFC dinamically linked application and it works fine on some computers (not installed with Visual C++ 5) but in one I got an assertion from a dlgdrop.cpp file which called a function in comctl32.dll. But I can't replace the .dll because its being used by windows. Is there a way to tell my application to look for the .dll not in the system directory but somewhere I'll put it in ?
0
Comment
Question by:oragon
[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
3 Comments
 
LVL 3

Accepted Solution

by:
plaroche earned 100 total points
ID: 1325267
I don't understand why you can't replace it. Go to microsoft's web site and download the latest common control update, it comes with its own installer and will update it for you.

If not then place the most recent version of the dll in the same directory as your application. It MIGHT work. But as you know, when a DLL is already loaded in memory it will only be mapped to your process, not reloaded. Chances are that this dll is loaded anytime an application starts, even if no application is running windows itself uses it.
0
 
LVL 1

Expert Comment

by:rascal
ID: 1325268
You should check the version of the dll and notify the user that they need to upgrade the dll. To check the version in your app:

// in your .h file:

// To determine version of ComCtl32
enum COMCTL32VERSION
{
    COMCTL32_UNKNOWN,COMCTL32_400,COMCTL32_470,COMCTL32_471
};
    static COMCTL32VERSION c_nComCtl32Version;
    static COMCTL32VERSION ComCtl32Version();

// in your .cpp file:
//*************************************************************************
// ComCtl32Version
//*************************************************************************
COMCTL32VERSION CStatusViewerApp::c_nComCtl32Version = COMCTL32_UNKNOWN;

COMCTL32VERSION CStatusViewerApp::ComCtl32Version() {
    // if we don't already know which version, try to find out
    if (c_nComCtl32Version == COMCTL32_UNKNOWN) {
        // have we loaded COMCTL32 yet?
        HMODULE theModule = ::GetModuleHandle(_T("COMCTL32"));
        // if so, then we can check for the version
        if (theModule) {
            // InitCommonControlsEx is unique to 4.7 and later
            FARPROC theProc = ::GetProcAddress(theModule, "InitCommonControlsEx");
            if (! theProc) {
                // not found, must be 4.00
                c_nComCtl32Version = COMCTL32_400;
                } else {
                // The following symbol are unique to 4.71
                //   DllInstall
                //   FlatSB_EnableScrollBar FlatSB_GetScrollInfo FlatSB_GetScrollPos
                //   FlatSB_GetScrollProp FlatSB_GetScrollRange FlatSB_SetScrollInfo
                //   FlatSB_SetScrollPos FlatSB_SetScrollProp FlatSB_SetScrollRange
                //   FlatSB_ShowScrollBar
                //   _DrawIndirectImageList _DuplicateImageList
                //   InitializeFlatSB
                //   UninitializeFlatSB
                // we could check for any of these - I chose DllInstall
                FARPROC theProc = ::GetProcAddress(theModule, "DllInstall");
                if (! theProc) {
                    // not found, must be 4.70
                    c_nComCtl32Version = COMCTL32_470;
                } else {
                    // found, must be 4.71
                    c_nComCtl32Version = COMCTL32_471;
                    }
                }
            }
        }
    return c_nComCtl32Version;
}

// Finally, call the function and check version
    // Make sure the proper dll version is in place
    if (ComCtl32Version() < COMCTL32_470)
    {
        << issue message to user >>
    }



0
 

Author Comment

by:oragon
ID: 1325269
I used LoadLibrary to force my application to user what looked like a better version of the comctl32.dll, and then I got an ASSERTION in tooltip.cpp line 383, but I looked at that line and found no ASSERT code there. There seems to be a mix-up in versions here, and I'm pretty lost. Also - In a tree control my application uses Images didn't appear (but I took the comctl32.dll file which on another computer seems to work fine).
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
deburging in oracle form 12 117
maxBlock challenge 30 149
viewing source code from eclipse 13 111
maven archtype selection in eclipse 1 59
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

731 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