Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/engine/Main.cpp

Issue 5673404602515456: Close and reopen IE and engine during intallation (Closed)
Patch Set: Created Feb. 10, 2014, 12:55 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « installer/msibuild.cmd ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « installer/msibuild.cmd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld