OverWriting Comctl32.dll during setup

Posted on 1998-10-30
Last Modified: 2013-12-26
Using VB5 setup wizard, i must Overwright on the user's machine, the file Comctl32.dll.
the setup wizard can't do that because this file is in use
by windows all the time, and can't be overwritten while
windows is running.
so, i have to do it manually, from DOS, be4 or after the setup.
BUT - i want to give the user an easy installation, without
those manuvers.
i'm sure i can write an app. that will make a restart and then copy it in DOS mode, but i'm looking for a way to make it In the installation itself.
Question by:AnswerTheMan

Expert Comment

ID: 1488063
Have you tried installing the version of the Comctl32.dll that you need to the application path.  Maybe that way you can leave the current version intact, but still use the version you need.

Just a thought,

Author Comment

ID: 1488064
yes i've try that.
not working.
windows using the version installed on windows\system ONLY

Expert Comment

ID: 1488065
You might try using the RunOnce registry key.  Basically, you could write a BAT file to copy and register the DLL the next time the machine is booted.

Here is a KB article about it:

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.


Author Comment

ID: 1488066
BAt file is allright, but to do this i have to force the autoexec.bat to run this file be4 win95 is loaded, so i have to add a line in autoexec.bat.
how can i do that ? u see, i don't have a fisically access to the
client machine.
and suppose i will know how to add that line - how would i delete it after one use ?
Or shell i tell the client he must have IE3.0(at least), on his
machine be4 installing my application (IE3.0 installs that file)
? is that a logical demand ?

Expert Comment

ID: 1488067
I was referring to the RunOnce registry key from the knowledge base article I posted.  It is a way to make it run your bat file one time the next time the computer is re-started...

Expert Comment

ID: 1488068
If you are running under NT, use MoveFileEx

If you are running under 95/98
Copy the file with a different name
Make an entry in the [rename] section of C:\windows\WinInit.ini
(create it if it doesn't exist)


Reboot the machine

Author Comment

ID: 1488069
i appreciate your answers fellows, but u don't get the picture :
i'm, shipping the setup on a CD 5000 miles away from my location
and can't be present on instalation.
the client computers have older version of the file, and he is
a typical user which i can't trust to do all those manuvers.
i need the setup program to do that.
if there is no way - i can tell him to install ie3.0 (free d\l)
on his machins preior to my app instalation. this will do the work for me.
still have time and waiting for ideas.

Expert Comment

ID: 1488070
I never use the VB setup thing anymore, I always use Wise, to do what you require in wise is a sigle click. There MUST be a similar function in the setupkit, otherwise the programmers would be too embarrassed to ship it!

Expert Comment

ID: 1488071

The comctl32.dll being used is NOT necessarily the one in Windows/System.  It is the one that is registered, which just happens to be in Windows/System.  This is what you do.  Include Regsvr32 with your setup.  Unregister the DLL in the windows/system.  (this is doable) then copy your comctl32.dll somewhere other than windows system (say the install dir) and use regsvr32 to register it.  You are done.

I think Microsoft has a comctl32 installer that you can include with your application that does this kind of stuff.


Author Comment

ID: 1488072
have u try to unregister a dll while in use by the os ??


Accepted Solution

tommy_boy earned 100 total points
ID: 1488073
A simple solution may be to have a bat file run from the users autoexec.bat

1) After installing, make a copy of the users autoexec.bat file, and create a bat file in the temp direcotry.  In that bat file place the folowing code (change the paths depending upon the users config):
copy c:\temp\...dll c:\windows\system\...dll
delete c:\....\autoexec.bat
rename c:\.....\autoexe.bak *.bat

2) Modify the users autoexec.bat file and add the code to run the above bat file.
3) restart the users pc
4) when the user restarts the autoexec will be run, the file will be copied and the system will clean itself up (ie autoexec will be reset).  Why do you think a lot of installs require you to resart the PC in order for changes to take effect.

Let me know ho wyou get on.


Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb6 programatically bring window to front 8 71
MsgBox 2 54
Determine Range to Select 5 48
maro to copy and paste from one worksheet to another based on a condition 11 53
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question ( in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

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