?
Solved

wrong comctl32.dll version

Posted on 1998-11-25
3
Medium Priority
?
321 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 400 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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

770 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