From winmain.cpp in the NPP source:
try {
notepad_plus_plus.init(hInstance, NULL, quotFileName.c_str(), &cmdLineParams);
bool unicodeSupported = notepad_plus_plus.getWinVersion() >= WV_NT;
bool going = true;
while (going)
{
going = (unicodeSupported?(::GetMessageW(&msg, NULL, 0, 0)):(::GetMessageA(&msg, NULL, 0, 0))) != 0;
if (going)
{
// if the message doesn't belong to the notepad_plus_plus's dialog
if (!notepad_plus_plus.isDlgsMsg(&msg, unicodeSupported))
{
if (::TranslateAccelerator(notepad_plus_plus.getHSelf(), notepad_plus_plus.getAccTable(), &msg) == 0)
{
::TranslateMessage(&msg);
if (unicodeSupported)
::DispatchMessageW(&msg);
else
::DispatchMessage(&msg);
}
}
}
}
} catch(int i) {
if (i == 106901)
::MessageBox(NULL, "Scintilla.init is failed!", "Notepad++ Exception: 106901", MB_OK);
else {
char str[50] = "God Damned Exception : ";
char code[10];
itoa(i, code, 10);
::MessageBox(NULL, strcat(str, code), "Notepad++ Exception", MB_OK);
}
doException(notepad_plus_plus);
}