| 355 | } |
| 356 | |
| 357 | void CScriptLevelInterface::OnEditscript() { |
| 358 | CComboBox *combo = (CComboBox *)GetDlgItem(IDC_SELECTED_SCRIPT); |
| 359 | if (!combo) |
| 360 | return; |
| 361 | |
| 362 | char tempbuf[_MAX_PATH], fullpath[_MAX_PATH]; |
| 363 | |
| 364 | int index = combo->GetCurSel(); |
| 365 | combo->GetLBText(index, tempbuf); |
| 366 | |
| 367 | if (m_ShowNonCheckedOut && (mng_FindTrackLock(tempbuf, PAGETYPE_GAMEFILE) == -1)) { |
| 368 | // display a warning that this file is not checked out |
| 369 | MessageBox("This file is NOT checked out, you'll lose all changes on your\nnext data update!", "Warning", MB_OK); |
| 370 | } |
| 371 | |
| 372 | ddio_MakePath(fullpath, LocalScriptDir, tempbuf, NULL); |
| 373 | if (!cfexist(fullpath)) { |
| 374 | sprintf(tempbuf, "Weird, I couldn't find %s to open...", fullpath); |
| 375 | MessageBox(tempbuf, "Error", MB_OK); |
| 376 | return; |
| 377 | } |
| 378 | |
| 379 | SHELLEXECUTEINFO sei; |
| 380 | |
| 381 | sei.cbSize = sizeof(sei); |
| 382 | sei.fMask = SEE_MASK_NOCLOSEPROCESS; |
| 383 | sei.hwnd = m_hWnd; |
| 384 | sei.lpVerb = "open"; |
| 385 | sei.lpFile = fullpath; |
| 386 | sei.lpParameters = NULL; |
| 387 | sei.lpDirectory = LocalScriptDir; |
| 388 | sei.nShow = SW_NORMAL; |
| 389 | |
| 390 | // int res = (int)ShellExecute(m_hWnd,"open",fullpath,NULL,LocalScriptDir,0); |
| 391 | int res; |
| 392 | |
| 393 | ShellExecuteEx(&sei); |
| 394 | res = (int)sei.hInstApp; |
| 395 | |
| 396 | if (res <= 32) { |
| 397 | char buffer[256]; |
| 398 | switch (res) { |
| 399 | case 0: |
| 400 | strcpy(buffer, "The operating system is out of memory or resources."); |
| 401 | break; |
| 402 | case ERROR_FILE_NOT_FOUND: |
| 403 | strcpy(buffer, "The specified file was not found."); |
| 404 | break; |
| 405 | case ERROR_PATH_NOT_FOUND: |
| 406 | strcpy(buffer, "The specified path was not found."); |
| 407 | break; |
| 408 | case ERROR_BAD_FORMAT: |
| 409 | strcpy(buffer, "The .exe file is invalid (non-Win32� .exe or error in .exe image)."); |
| 410 | break; |
| 411 | case SE_ERR_ACCESSDENIED: |
| 412 | strcpy(buffer, "The operating system denied access to the specified file."); |
| 413 | break; |
| 414 | case SE_ERR_ASSOCINCOMPLETE: |
nothing calls this directly
no test coverage detected