PDA

View Full Version : Registering COM objects



BRYPIE
04-05-2002, 06:48 AM
Hi folks,

I have a problem with my install.

Part of my installation structure looks like the following:

\Shared
+--------\Programs
+--------\Com

I have some DLLs installed to the "Shared\Programs" folder, and some COM objects and DLLs installed to the "Shared\Com" folder.

However, I need to register some of the com objects. To register properly, they rely on some of the DLLs in the "Shared\Programs" folder.
What I need to do is to write the location of "Shared\Programs" to the Windows PATH environment variable, so that when the COM objects get registered, they can find the relevant DLLs.

How can I write this information to the PATH environment variable, and then force that to be re-read so that the COM objects register properly?

Any help would be appreciated...
Thanks in advance.

Prince
04-05-2002, 07:31 AM
Right click your COM, DLLs from IDE and select properties from pop-up menu. Now check the self-register checkbox. This would automatically register your COM DLLs whenever you install this setup.

Hope this helps !!

BRYPIE
04-05-2002, 07:55 AM
Thanks,

I know how to do that, but my problem is that when these COM objects register, they depend upon a DLL which is installed to the OTHER folder.

I need to be able to change and update the PATH environment variable, so that when the COM objects are registered, they can find the DLL that they depend upon.

Any ideas?

I'm trying to make the merge module I have created for the COM objects dependant upon the different merge module I have for the other files, which updated the environment variable.
Would this work?

akaStacy
04-05-2002, 08:37 AM
I know that's not the right way to do it, but nothing else comes to mind, so... I'd write a .bat file that sets the path locally and then registers the objects and call it from the install script.

Does anybody know of an easy way to update PATH without rebooting? on all OSs?

Happy Days
04-05-2002, 09:02 AM
Hi,

You can use the BatchAdd function of the InstallScript to add the path in the autoexec.bat file.

Hope it works...

LewisQ
04-05-2002, 09:16 AM
From the top of my head, it is too early to think clearly. Anyway, this should help you. It is for NT/2K,XP.



// Definitions
#define WM_WININICHANGE 0x001A
#define HWND_BROADCAST 0xffff

function Whatever()
STRING szEnv, svValue;
POINTER pEnv;
NUMBER nReturn, nResult, nvType, nvSize;
begin
RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
RegDBGetKeyValueEx ( "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", "Path", nvType, svValue, nvSize );
svValue = svValue + ";" + '\\Something" ;
RegDBSetKeyValueEx ( "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", "Path", REGDB_STRING, svValue, -1 );

// Flush env vars...
szEnv = "Environment";
pEnv = &szEnv;
SendMessage ( HWND_BROADCAST, WM_WININICHANGE, 0, pEnv );
// Do whatever else you need such as registering stuff, etc, etc, etc
end;


Of course, you may need to change the path back again later on..

KathyMorey
04-05-2002, 10:22 AM
I seem to remember in IS Pro that there was a small problem in that the IS engine did not process broadcast messages, and so didn't recognize the new path. Is that still true in Developer 7?

Kathy

LewisQ
04-05-2002, 10:25 AM
We only used it once and it worked.