204 } 205 206 void WindowsPlatform::ShowMessage(TString description) { 207 TString appname = GetModuleFileName(); 208 appname = FilePath::ExtractFileName(appname); 209 MessageBox(NULL, description.data(), appname.data(), MB_ICONERROR | MB_OK); 210 } 211 212 MessageResponse WindowsPlatform::ShowResponseMessage(TString title, 213 TString description) { 214 MessageResponse result = mrCancel; 215 216 if (::MessageBox(NULL, description.data(), title.data(), MB_OKCANCEL) == 217 IDOK) { 218 result = mrOK; 219 } 220 221 return result; 222 } 223 224 TString WindowsPlatform::GetBundledJVMLibraryFileName(TString RuntimePath) { 225 TString result = FilePath::IncludeTrailingSeparator(RuntimePath) + 226 _T("jre\\bin\\jli.dll"); 227 228 if (FilePath::FileExists(result) == false) { 229 result = FilePath::IncludeTrailingSeparator(RuntimePath) + 230 _T("bin\\jli.dll"); 231 } 232 233 return result; 234 } 235 236 ISectionalPropertyContainer* WindowsPlatform::GetConfigFile(TString FileName) { 237 IniFile *result = new IniFile(); 238 if (result == NULL) { 239 return NULL; 240 } 241 242 if (result->LoadFromFile(FileName) == false) { 243 // New property file format was not found, 244 // attempt to load old property file format. 245 Helpers::LoadOldConfigFile(FileName, result); 246 } 247 248 return result; 249 } 250 251 TString WindowsPlatform::GetModuleFileName() { 252 TString result; 253 DynamicBuffer<wchar_t> buffer(MAX_PATH); 254 if (buffer.GetData() == NULL) { 255 return result; 256 } 257 258 ::GetModuleFileName(NULL, buffer.GetData(), 259 static_cast<DWORD> (buffer.GetSize())); 260 261 while (ERROR_INSUFFICIENT_BUFFER == GetLastError()) { 262 if (!buffer.Resize(buffer.GetSize() * 2)) { 263 return result; 264 } 265 ::GetModuleFileName(NULL, buffer.GetData(), 266 static_cast<DWORD> (buffer.GetSize())); | 204 } 205 206 void WindowsPlatform::ShowMessage(TString description) { 207 TString appname = GetModuleFileName(); 208 appname = FilePath::ExtractFileName(appname); 209 MessageBox(NULL, description.data(), appname.data(), MB_ICONERROR | MB_OK); 210 } 211 212 MessageResponse WindowsPlatform::ShowResponseMessage(TString title, 213 TString description) { 214 MessageResponse result = mrCancel; 215 216 if (::MessageBox(NULL, description.data(), title.data(), MB_OKCANCEL) == 217 IDOK) { 218 result = mrOK; 219 } 220 221 return result; 222 } 223 224 TString WindowsPlatform::GetBundledJavaLibraryFileName(TString RuntimePath) { 225 TString result = FilePath::IncludeTrailingSeparator(RuntimePath) + 226 _T("jre\\bin\\jli.dll"); 227 228 if (FilePath::FileExists(result) == false) { 229 result = FilePath::IncludeTrailingSeparator(RuntimePath) + 230 _T("bin\\jli.dll"); 231 } 232 233 return result; 234 } 235 236 ISectionalPropertyContainer* WindowsPlatform::GetConfigFile(TString FileName) { 237 IniFile *result = new IniFile(); 238 if (result == NULL) { 239 return NULL; 240 } 241 242 result->LoadFromFile(FileName); 243 244 return result; 245 } 246 247 TString WindowsPlatform::GetModuleFileName() { 248 TString result; 249 DynamicBuffer<wchar_t> buffer(MAX_PATH); 250 if (buffer.GetData() == NULL) { 251 return result; 252 } 253 254 ::GetModuleFileName(NULL, buffer.GetData(), 255 static_cast<DWORD> (buffer.GetSize())); 256 257 while (ERROR_INSUFFICIENT_BUFFER == GetLastError()) { 258 if (!buffer.Resize(buffer.GetSize() * 2)) { 259 return result; 260 } 261 ::GetModuleFileName(NULL, buffer.GetData(), 262 static_cast<DWORD> (buffer.GetSize())); |