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
Solved

wrong comctl32.dll version

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand macro to ask for filename column 8 37
Window placement 17 87
Way to decrease size of apk file 9 86
How do I get Window Title of all opened process? 4 13
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

861 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