From 33f3028e95f2810ff1c75a5813e717b48c55ec79 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sun, 28 Feb 2016 16:29:34 +0000 Subject: Import: servicemode support git-svn-id: http://svn.miranda-ng.org/main/trunk@16370 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Import/src/main.cpp | 10 ++++++++-- plugins/Import/src/wizard.cpp | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/Import/src/main.cpp b/plugins/Import/src/main.cpp index 5526cdf435..b7dde39442 100644 --- a/plugins/Import/src/main.cpp +++ b/plugins/Import/src/main.cpp @@ -75,7 +75,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) ///////////////////////////////////////////////////////////////////////////////////////// // MirandaInterfaces - returns the protocol interface to the core -extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_IMPORT, MIID_LAST}; +extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_IMPORT, MIID_SERVICEMODE, MIID_LAST}; ///////////////////////////////////////////////////////////////////////////////////////// // Performs a primary set of actions upon plugin loading @@ -105,12 +105,18 @@ static int OnExit(WPARAM, LPARAM) return 0; } +static INT_PTR ServiceMode(WPARAM, LPARAM) +{ + CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_WIZARD), NULL, WizardDlgProc, 1); + return SERVICE_ONLYDB; +} + extern "C" __declspec(dllexport) int Load(void) { mir_getLP( &pluginInfo ); hImportService = CreateServiceFunction(IMPORT_SERVICE, ImportCommand); - + CreateServiceFunction(MS_SERVICEMODE_LAUNCH, ServiceMode); RegisterIcons(); // menu item diff --git a/plugins/Import/src/wizard.cpp b/plugins/Import/src/wizard.cpp index c39fc91927..fc0c4a89aa 100644 --- a/plugins/Import/src/wizard.cpp +++ b/plugins/Import/src/wizard.cpp @@ -94,6 +94,7 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP switch (message) { case WM_INITDIALOG: + SetWindowLong(hdlg, GWL_USERDATA, lParam); TranslateDialogDefault(hdlg); hwndPage = CreateDialog(hInst, MAKEINTRESOURCE(IDD_WIZARDINTRO), hdlg, WizardIntroPageProc); SetWindowPos(hwndPage, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE); @@ -158,6 +159,9 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP DestroyWindow(hwndPage); DestroyWindow(hdlg); break; + case WM_DESTROY: + if (GetWindowLong(hdlg, GWL_USERDATA)) + PostQuitMessage(0); } return FALSE; -- cgit v1.2.3