003
27.07.2007, 20:19 Uhr
Braunstein
|
Hallo,
Hier ist mal ein Beispiel
C++: |
void RunApplication(const std::string &FileName, const std::string &FileParam) { int ret = (int) ShellExecute(0, "open", FileName.c_str(), FileParam.c_str(), 0, SW_SHOWNORMAL);
if (ret <= 32) { string msg;
switch(ret) { case ERROR_FILE_NOT_FOUND, SE_ERR_FNF : msg = "File '" + FileName + "' not found!"; break;
case ERROR_PATH_NOT_FOUND, SE_ERR_PNF : msg = "Path to the file '" + FileName + "' not found!"; break;
case ERROR_BAD_FORMAT : msg = "The called code is corrupt!"; break;
case SE_ERR_ACCESSDENIED, SE_ERR_SHARE : msg = "Access to file '" + string(FileName) + "' denied!"; break;
case SE_ERR_ASSOCINCOMPLETE, SE_ERR_NOASSOC : msg = "The filetype is not connected to application!"; break;
case 0, SE_ERR_OOM : msg = "Not enough memory to start the application!"; break;
default : msg = "File '" + string(FileName) + "' cannot be opened!"; } // Fehlermeldung ausgeben, hier beim BCB // Application->MessageBox(msg.c_str(), "Error", MB_OK + MB_ICONERROR); } }
|
|