View Full Version : Need Help With Code Please.
03-11-2004, 12:38 PM
I'm not very good with this programming stuff, so if anyone could please help me with a code I need, it would be greatly apprciated. Everything I try I always get a build failed error. This is what I am needing.
Renaming a file comctl32.ocx located in the system folder for all windows versions. Rename it to something like comctl32_backup.ocx. Then I would like it to copy comctl32.ocx from the autoplay root to the windows system folder (All windows versions). When it has finished replacing the file a status dialog message saying the update has completed.
I hope this is simple for someone to help me with. You can email me the code at firstname.lastname@example.org.
Thanks so much.
A couple things to be aware of here. It is not generally a good idea to replace an OCX file with another unless you sure that you are replacing with a newer version of the OCX. Replacing with an older OCX can cause you many problems in other apps. Especially this particular OCX since it is part of the Windows Common Controls.
Also, if the file is in use by any Windows App, you won't be able to replace/rename it until they are closed.
Since its an ActiveX control, it'll need to be registered with the OS if in fact you do replace the original.
Do you mind if I ask what you are trying to accomplish?
(besides the obvious anyway)
03-11-2004, 01:02 PM
Our problem is that other software programs that our customer has installed, is replacing this ocx file with an older version that our's is not compatible with. I am fully aware that it could effect other software, but in our industry our customer's value our software far more than any other they are using and are will to take the chance. After putting more thought into this, I think it would be a good idea to have an addition code that would reverse the whole thing just in case. Can you help me with this?
Thanks so much for your time.
if File.DoesExist(_SystemFolder .. "\\Comctl32_old.ocx") then
File.Delete(_SystemFolder .. "\\comctl32_old.ocx", false, false, false, nil)
if File.DoesExist(_SystemFolder .. "\\comctl32.ocx") then
File.Rename(_SystemFolder .. "\\comctl32.ocx", _SystemFolder .. "\\comctl32_old.ocx");
if error ~= 0 then
result = Dialog.Message("Error", "Please close all applications and try again.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1)
File.Copy("AutoPlay\\Docs\\comctl32.ocx", _SystemFolder .. "\\comctl32.ocx", false, true, false, false, nil);
File.Run("regsvr32.exe", "/s" .. _SystemFolder .. "\\comctl32.ocx", "", SW_MINIMIZE);
03-11-2004, 02:16 PM
in addition to Worms code you should check if there is a never version bevor you start copying your file.
Version = File.GetVersionInfo(_SystemFolder.."\\comctl32.ocx");
if (String.CompareFileVersions(Your_OCX_Version, Version.FileVersion))>=0 then
I thought the same, but she implied that the version she was putting in place was "the" version to have in place for the software, so I skipped the check.
03-11-2004, 02:35 PM
Your right, but replacing a newer version with an older is never a good idea and should not be done.
I agree whole heartedly and indicated that in my first reply.
I am fully aware that it could effect other software, but in our industry our customer's value our software far more than any other they are using and are will to take the chance.
03-11-2004, 03:43 PM
Thank you for all of your help. I was able to get what I needed. You guys were great!
Have a good day.
Powered by vBulletin™ Version 4.0.6 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.