Solved

wrong comctl32.dll version

Posted on 1998-11-25
3
300 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
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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…
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now