Guest User

Untitled

a guest
Apr 20th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1.         String ^ GetSteamLocation()
  2.         {
  3.             try
  4.             {
  5.                 RegistryKey ^ Key = Registry::LocalMachine->OpenSubKey(L"SOFTWARE\Valve\Steam");
  6.  
  7.                 String ^ SteamLocation = Key->GetValue(L"InstallPath")->ToString();
  8.  
  9.                 // I'm not exactly sure if the Close() method will free the resources for you, so I'm calling Dispose() just in case.
  10.                 Key->Close();
  11.                 Key->Dispose();
  12.  
  13.                 if (String::IsNullOrEmpty(SteamLocation))
  14.                 {
  15.                     return String::Empty;
  16.                 }
  17.                 else
  18.                 {
  19.                     return SteamLocation;
  20.                 }
  21.             }
  22.             catch (System::Exception ^ Error)
  23.             {
  24.                 return String::Empty;
  25.             }
  26.         }
Add Comment
Please, Sign In to add comment