Installation Challenges with OCXs and DLLs

I have been handed an installation that does not work properly.  At the end of the install we attempt to register some in-house OCX's and DLL's.  They fail in the install, but if you reboot and then register they succeed.  Why?  knowing how to force a reboot out of installshield and automatically registering upon return would be sufficient, but I would appreciate any good reasons for the initial failure as well.  Thanks in advance.
LVL 1
BigOneAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jkrCommented:
The reason probably is that you're also updating system DLLs (like e.g. the DAO Engine or an MFC DLL). As these DLLs are mostly in use, InstallShield places a '[rename]' section in wininit.ini (or uses 'MoveFileEx (..., MOVEFILE_DEAY_UNTIL_REBOOT,...);' on NT), which causes Windows to actually move the files before the system starts. To remedy this, place an entry like this in the registry:

function SetupRegistry()
STRING szKey, szValueName, szValue;
INT nSize, nType;
 begin

//...

RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE);

szKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce";
szValueName = "myocxreg";
szValue     = "regsvr32.exe /s myocx.ocx";
RegDBSetKeyValueEx ( szKey, szValueName, nType, szValue, nSize);

  return 0;
 end;


Feel free to ask if you need more information!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BigOneAuthor Commented:
Great answer, thanks for the help.  I am registering several OCXs and Dlls and they must be registered in the proper order.  Using your method they were called in the desired order, but can I rely on the order of execution following the order entered?  How does RunOnce work?  Any additional info would be appreciated.
0
jkrCommented:
Hmpf, MSDN Online is sooo *slow* at the moment that I hardly can provide links, and my local edition holds no information on the processing order - from my experience with the Registry APIs, the entries should be processed in alphabetical order (value name). If you don't want to rely on this, I'd suggest using a little (invisible) application that does the registration for you. Links will follow as soon as I get a response from the MS server ;-)

Here's the definition of these keys:

Knowledge Base
Definition of the RunOnce Keys in the Registry
Article ID: Q137367
Creation Date: 26-SEP-1995
Revision Date: 21-NOV-1996
The information in this article applies to:

Microsoft Windows 95

SUMMARY


There are seven Run keys in the registry that cause programs to be run automatically:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\ RunServices
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\ RunServicesOnce
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\ RunOnce\Setup

MORE INFORMATION

Keys 1-4 are run each time a new user logs in.

Keys 5-6 are run in the background when the logon dialog box first appears, or at this stage of the boot process if there is no logon. These keys are for background services such as remote registry service and are run only once per boot.

Key 7 is run as part of Setup's first-boot activities, or after you use the Add/Remove Programs Wizard.

Under each of these keys is a series of subkeys. The subkeys are used to allow multiple sub-entries to exist without overwriting one another.

The value for a subkey is a command line. By default, Run keys are ignored in Safe mode. For keys 3-4, the command line can be prefixed with an exclamation point to defer deletion of the subkey until after the command has been completed.

For keys 3, 4, and 6, the subkey is deleted before the command line is run unless overridden as noted above. As a result, if a RunOnce operation fails to run properly, the component that failed will not be asked to run again the next time you start the computer.

Key 7 is used only by Setup. This key displays the progress dialog box as the keys are run one at a time. For key 7, the name of the subkey is the name that is displayed in the dialog box.


 
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Installation

From novice to tech pro — start learning today.