From be92c7714135da5e18bbc066d7187d0f36443139 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 8 Mar 2016 11:28:17 +0000 Subject: crash fix git-svn-id: http://svn.miranda-ng.org/main/trunk@16447 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ImportTXT/importtxt.dpr | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/plugins/ImportTXT/importtxt.dpr b/plugins/ImportTXT/importtxt.dpr index db5041653d..7a586f2f70 100644 --- a/plugins/ImportTXT/importtxt.dpr +++ b/plugins/ImportTXT/importtxt.dpr @@ -25,7 +25,7 @@ uses Windows, Messages, SysUtils, - Inifiles, + IniFiles, m_api,// in '.\inc\m_api.pas', { используются в ImportThrd KOL in '.\kol\kol.pas', @@ -48,8 +48,6 @@ const MIID_IMPORTTEXT:TGUID = '{6F376B33-D3F4-4c4f-A96B-77DA08043B06}'; var hwndWizard:HWND; hwndDialog:HWND; - //Services - SrvITxt,SrvIWiz:THANDLE; function MirandaPluginInfoEx(mirandaVersion:DWORD):PPLUGININFOEX; cdecl; begin @@ -112,14 +110,23 @@ begin result := 0; end; +function OnPreShutdown(wParam: wParam; lParam: lParam): int; cdecl; +begin + if (hwndWizard <> 0) then + SendMessage(hwndWizard, WM_CLOSE, 0, 0); + result := 0; +end; + function Load(): int; cdecl; var mi:TMO_MenuItem; begin cp := Langpack_GetDefaultCodePage; + + CreateServiceFunction(IMPORT_TXT_SERVICE, @ContactMenuCommand); + CreateServiceFunction(IMPORT_WIZ_SERVICE, @MainMenuCommand); + SET_UID(@mi, '5FC2C67E-A16B-47B7-A6A1-40BE922CCD93'); - SrvITxt := CreateServiceFunction(IMPORT_TXT_SERVICE, @ContactMenuCommand); - SrvIWiz := CreateServiceFunction(IMPORT_WIZ_SERVICE, @MainMenuCommand); FillChar(mi, sizeof(mi), 0); mi.position := 1000090050; mi.hIcon := LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DEFAULT)); @@ -133,14 +140,13 @@ begin Menu_AddMainMenuItem(@mi); HookEvent(ME_SYSTEM_MODULESLOADED, @OnModulesLoaded); + HookEvent(ME_SYSTEM_PRESHUTDOWN, @OnPreShutdown); HookEvent(ME_PROTO_ACCLISTCHANGED, @OnAccountChanged); result := 0; end; function Unload: int; cdecl; begin - DestroyServiceFunction(SrvITxt); - DestroyServiceFunction(SrvIWiz); Result := 0; end; -- cgit v1.2.3