[TRUCO DELPHI] Definir una Variable del Sistema.
delphi
procedure SetSystemEnvironmentVariable (const name, value : string); var rv : DWORD; begin with TRegistry.Create do try RootKey := HKEY_LOCAL_MACHINE; OpenKey ('SYSTEM\CurrentControlSet\Control\SessionManager\Environment', False); WriteExpandString (name, value); SendMessageTimeout (HWND_BROADCAST, WM_SETTINGCHANGE, 0, LParam (PChar ('Environment')), SMTO_ABORTIFHUNG, 5000, rv); finally Free end end;
Saludos!