From 505fba9b79cccb701f90d3029d4e43c65824b8ba Mon Sep 17 00:00:00 2001 From: Don Ho Date: Wed, 13 Jul 2011 23:32:57 +0000 Subject: [PATCH] [BUG_FIXED] Detect the absence of Scintilla. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@786 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/NppBigSwitch.cpp | 9 +++++++-- PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp | 8 ++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 072b157de..c007eefdb 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -69,8 +69,13 @@ LRESULT Notepad_plus_Window::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPA { case WM_CREATE: { - _notepad_plus_plus_core._pPublicInterface = this; - result = _notepad_plus_plus_core.init(hwnd); + try{ + _notepad_plus_plus_core._pPublicInterface = this; + result = _notepad_plus_plus_core.init(hwnd); + } catch (std::exception ex) { + ::MessageBoxA(_notepad_plus_plus_core._pPublicInterface->getHSelf(), ex.what(), "Exception On WM_CREATE", MB_OK); + exit(-1); + } } break; default: diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index dd2194123..7d1ec34e6 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -153,7 +153,7 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere) { if (!_hLib) { - throw std::runtime_error("ScintillaEditView::init : SCINTILLA ERROR - Can not load the dynamic library"); + throw std::exception("ScintillaEditView::init : SCINTILLA ERROR - Can not load the dynamic library"); } Window::init(hInst, hPere); @@ -170,7 +170,7 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere) if (!_hSelf) { - throw std::runtime_error("ScintillaEditView::init : CreateWindowEx() function return null"); + throw std::exception("ScintillaEditView::init : CreateWindowEx() function return null"); } _pScintillaFunc = (SCINTILLA_FUNC)::SendMessage(_hSelf, SCI_GETDIRECTFUNCTION, 0, 0); @@ -180,12 +180,12 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere) if (!_pScintillaFunc) { - throw std::runtime_error("ScintillaEditView::init : SCI_GETDIRECTFUNCTION message failed"); + throw std::exception("ScintillaEditView::init : SCI_GETDIRECTFUNCTION message failed"); } if (!_pScintillaPtr) { - throw std::runtime_error("ScintillaEditView::init : SCI_GETDIRECTPOINTER message failed"); + throw std::exception("ScintillaEditView::init : SCI_GETDIRECTPOINTER message failed"); } execute(SCI_SETMARGINMASKN, _SC_MARGE_FOLDER, SC_MASK_FOLDERS);