13 #if defined(AJA_WINDOWS)
18 write_registry_string(HKEY hkey, std::string key_path, std::string key, std::string value)
20 bool outValue =
false;
22 DWORD dwType = REG_EXPAND_SZ;
23 DWORD dwInSize = (DWORD)
value.size();
28 long lResult = RegCreateKeyExA(hkey, key_path.c_str(), 0,
NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_WOW64_64KEY,
NULL, &openedPathHkey, &disposition);
29 if(ERROR_SUCCESS == lResult)
31 lResult = RegSetValueExA(openedPathHkey,
key.c_str(),
NULL, dwType, (BYTE*)
value.c_str(), dwInSize);
32 if (lResult == ERROR_SUCCESS)
36 RegCloseKey(openedPathHkey);
43 write_registry_dword(HKEY hkey, std::string key_path, std::string key, DWORD value)
45 bool outValue =
false;
47 DWORD dwType = REG_DWORD;
48 DWORD dwInSize =
sizeof(
value);
53 long lResult = RegCreateKeyExA(hkey, key_path.c_str(), 0,
NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE|KEY_WOW64_64KEY,
NULL, &openedPathHkey, &disposition);
54 if(ERROR_SUCCESS == lResult)
56 lResult = RegSetValueExA(openedPathHkey,
key.c_str(),
NULL, dwType, (BYTE*)&value, dwInSize);
57 if (lResult == ERROR_SUCCESS)
61 RegCloseKey(openedPathHkey);
68 read_registry_string(HKEY hkey, std::string key_path, std::string key)
72 const DWORD buffSize = 128;
73 char szBuff[buffSize];
74 memset(szBuff, 0, buffSize);
77 DWORD dwInOutSize = buffSize;
80 long lResult = RegOpenKeyExA(hkey, key_path.c_str(), 0, KEY_QUERY_VALUE|KEY_WOW64_64KEY, &openedPathHkey);
81 if(ERROR_SUCCESS == lResult)
83 lResult = RegQueryValueExA(openedPathHkey,
key.c_str(),
NULL, &dwType, (BYTE*)szBuff, &dwInOutSize);
84 if (lResult == ERROR_SUCCESS)
89 RegCloseKey(openedPathHkey);
96 read_registry_dword(HKEY hkey, std::string key_path, std::string key)
101 DWORD dwInOutSize =
sizeof(outValue);
104 long lResult = RegOpenKeyExA(hkey, key_path.c_str(), 0, KEY_QUERY_VALUE|KEY_WOW64_64KEY, &openedPathHkey);
105 if(ERROR_SUCCESS == lResult)
107 lResult = RegQueryValueExA(openedPathHkey,
key.c_str(),
NULL, &dwType, (BYTE*)&outValue, &dwInOutSize);
108 RegCloseKey(openedPathHkey);
116 std::ostringstream oss;
117 oss <<
"explorer /select," <<
"\"" << filePath <<
"\"";
118 return ::system(oss.str().c_str());
123 #endif //end AJA_WINDOWS
130 std::ostringstream oss;
131 oss <<
"/usr/bin/osascript" <<
" -e \"" <<
"tell application \\\"Finder\\\"" <<
"\""
132 <<
" -e \"" <<
"activate" <<
"\""
133 <<
" -e \"" <<
"reveal \\\"" + filePath +
"\\\" as POSIX file" <<
"\""
134 <<
" -e \"" <<
"end tell" <<
"\"";
135 return ::system(oss.str().c_str());
140 #if defined(AJA_LINUX)
148 std::ostringstream oss;
149 oss <<
"xdg-open " <<
"\"" << dirname((
char*)filePath.c_str()) <<
"\"";
150 return ::system(oss.str().c_str());
153 #endif //end AJA_LINUX