Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Setting Updated Path


4 replies to this topic

tSunami akp

tSunami akp
  • Members
  • 12 posts

Posted 15 February 2002 - 08:07

For various reasons i need to create a directory which will contain non self registering DLLs. Since DLLs are searched in the PATH directories, the PATH has to be updated.

For example let the directory be C:\MyDlls.
The path should be update to %PATH%;C:\MyDlls. The next time if use any function such as UseDLL( ), the function should succeed without specifying the absolute path of the DLL.


Ide Nentjes

Ide Nentjes
  • Members
  • 222 posts

Posted 15 February 2002 - 10:04

If you're working under NT/2000, see the scripts in 'IS5/6 Samples> Opreating System'

Note that changes in the environment only get passed to installshield if you are running it directly with setup.exe. If you're running your setup from the IDE, changes in environment don't get through to the setup.

Ide


Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 15 February 2002 - 17:05

Since for some reason you posted twice, again, here's some example code:

// FOR PATH SYSTEM VARIABLE, ADD REFERENCE TO THE INSTALL FOLDER
Disable(LOGGING);
RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE);
szTNDKey = "\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
szTNDClass = "";
if ( RegDBKeyExist ( szTNDKey ) < 0 ) then
   MessageBox(szMsg, SEVERE);
   exit;
endif;

szTNDStrName = "Path";
RegDBGetKeyValueEx ( szTNDKey, szTNDStrName, nvType, szTNDStrValue, nvSize);
if (!( szTNDStrValue % TARGETDIR )) then
   szTNDStrValue = szTNDStrValue ^ ";";
   szTNDStrValue = szTNDStrValue + TARGETDIR ^ "\\BIN";
   RegDBSetKeyValueEx ( szTNDKey, szTNDStrName, REGDB_STRING_EXPAND, szTNDStrValue, -1 );
endif;
Enable(LOGGING);


Ide Nentjes

Ide Nentjes
  • Members
  • 222 posts

Posted 15 February 2002 - 17:24

That won't work until you broadcast the new environment:

 #define WM_WININICHANGE   0x001A
 #define HWND_BROADCAST    0xffff

function VOID BroadcastEnvironment()  
 STRING  svEnv;
 POINTER pEnv;
begin
 
 // All expanded Strings are now written to the registry. Broadcast.
 svEnv = "Environment";
 pEnv = &svEnv;
 SendMessage (HWND_BROADCAST, WM_WININICHANGE, 0, pEnv );
end;


Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 15 February 2002 - 19:40

Okay, on the duplicate post someone said the same thing.  Maybe they were repeating you.  In any case, I'll repeat myself.

--

Okay, that would certainly force it., but if you're install already requires a reboot then that would also take care of updating it.

Good to know though Ide, thanks.