Index: src/engine/Main.cpp |
=================================================================== |
--- a/src/engine/Main.cpp |
+++ b/src/engine/Main.cpp |
@@ -378,6 +378,42 @@ |
return filterEngine; |
} |
+LRESULT CALLBACK NotificationWindowThread(HWND window, UINT message, |
+ WPARAM wParam, LPARAM lParam) |
+{ |
+ switch (message) |
+ { |
+ case WM_CLOSE: |
+ // Make sure that all our C streams will be flushed and closed correctly (no corrupt files) |
+ exit(0); |
+ break; |
+ } |
+ return DefWindowProc(window, message, wParam, lParam); |
+} |
+ |
+ |
+DWORD WINAPI NotificationWindowStart(void*) |
+{ |
+ const std::wstring windowClassName = L"ABP_NOTIFICATION_WINDOW"; |
+ WNDCLASSEXW windowClass = {}; |
+ windowClass.cbSize = sizeof(windowClass); |
+ windowClass.lpfnWndProc = NotificationWindowThread; |
+ windowClass.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_MENU + 1); |
+ windowClass.lpszClassName = windowClassName.c_str(); |
+ windowClass.hInstance = GetModuleHandle(NULL); |
+ RegisterClassEx(&windowClass); |
+ |
+ CreateWindowExW(WS_EX_TOPMOST, windowClassName.c_str(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); |
+ |
+ // Main message loop: |
+ MSG msg; |
+ while (GetMessage(&msg, NULL, 0, 0)) |
+ { |
+ TranslateMessage(&msg); |
+ DispatchMessage(&msg); |
+ } |
+ return (int)msg.wParam; |
+} |
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) |
{ |
AutoHandle mutex(CreateMutexW(0, false, L"AdblockPlusEngine")); |
@@ -401,6 +437,7 @@ |
filterEngine = CreateFilterEngine(locale); |
updater.reset(new Updater(filterEngine->GetJsEngine())); |
+ CreateThread(NULL, NULL, &NotificationWindowStart, NULL, NULL, NULL); |
for (;;) |
{ |
try |