Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 17th, 2012  |  syntax: None  |  size: 0.45 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Update Environment Variable when changes made from My Computer
  2. DWORD BufferSize = 16383;  
  3.     TCHAR pathVar[16383];
  4.        
  5. GetEnvironmentVariable(_T("Path"),pathVar,16383);
  6.        
  7. DWORD dwRet = RegGetValue(HKEY_LOCAL_MACHINE,
  8.     _T("SYSTEM\CurrentControlSet\Control\Session Manager\Environment"),
  9.     _T("Path"), RRF_RT_ANY, NULL, (PVOID)&pathVar, &BufferSize);
  10.  
  11.     if(dwRet != ERROR_SUCCESS){
  12.         GetEnvironmentVariable(_T("Path"),pathVar,16383);
  13.     }