Solved

wrong comctl32.dll version

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
xyBalance chalenge 58 88
repeateFront java challenge 31 92
abstract class with all non abstract mentods 6 76
Execute multiple curl cmds with sleep and send output to file 10 89
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

863 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

20 Experts available now in Live!

Get 1:1 Help Now