C# Updating Environment Variable - SendMessageTimeout -


i'm trying set system environment variable, note change reflected i've got sendmessagetimeout update windows.

i can run, , return 0 result, environment variable not ever updated.

[flags] public enum sendmessagetimeoutflags : uint {     smto_normal = 0x0,     smto_block = 0x1,     smto_abortifhung = 0x2,     smto_notimeoutifnothung = 0x8 }  [dllimport("user32.dll", setlasterror = true, charset = charset.auto)] public static extern intptr sendmessagetimeout( intptr hwnd, uint msg, uintptr wparam, intptr lparam, sendmessagetimeoutflags fuflags, uint utimeout, out uintptr lpdwresult);   string reg_subkey = "test1"; string reg_name = @"hkey_local_machine\system\currentcontrolset\control\session manager\environment"; registry.setvalue(reg_name, reg_subkey, "testing", registryvaluekind.string);  intptr hwnd_broadcast = new intptr(0xffff); const uint wm_wininichange = 0x001a; const uint wm_settingchange = wm_wininichange; const int msg_timeout = 15000; uintptr result;  string environment = "environment";  sendmessagetimeout(hwnd_broadcast, wm_settingchange, uintptr.zero, (intptr)marshal.stringtohglobalansi(environment), sendmessagetimeoutflags.smto_abortifhung, msg_timeout, out result); 

the easiest way use environment.setenvironmentvariable. calls sendmessagetimeout internally.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -