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


3 replies to this topic

tSunami akp

tSunami akp
  • Members
  • 12 posts

Posted 15 February 2002 - 08:11

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 updated 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.

(Edited by tSunami akp at 12:17 pm on Feb. 15, 2002)


Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 15 February 2002 - 17:00

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);


Giurcanu Daniel

Giurcanu Daniel
  • Members
  • 51 posts

Posted 15 February 2002 - 17:06

This is not enough
szEnv = "Enviroment";
pEnv = &szEnv;
SendMessage (HWND_BROADCAST, WM_WININICHANGE, 0, pEnv );
this  should update the path variable for all running processes.


Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 15 February 2002 - 19:37

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 GD, thanks.