From 534eefa7029aaf49b0b673b6f6fb630752bb3fd5 Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Wed, 18 Mar 2015 07:13:47 +0000 Subject: Pascal: service executing fix) git-svn-id: http://svn.miranda-ng.org/main/trunk@12427 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Utils.pas/awkservices.pas | 60 +++++++++++++++++++-------------------- plugins/Utils.pas/mirutils.pas | 2 +- plugins/Utils.pas/sparam.pas | 10 ++++++- plugins/Utils.pas/srvblock.pas | 2 +- plugins/Utils.pas/syswin.pas | 8 ++++++ plugins/Utils.pas/wrapper.pas | 14 ++++++++- 6 files changed, 62 insertions(+), 34 deletions(-) (limited to 'plugins/Utils.pas') diff --git a/plugins/Utils.pas/awkservices.pas b/plugins/Utils.pas/awkservices.pas index 4ab6f851cb..b962028497 100644 --- a/plugins/Utils.pas/awkservices.pas +++ b/plugins/Utils.pas/awkservices.pas @@ -79,63 +79,63 @@ procedure ClearSubstData(var data:tSubstData); {} //----- Parameter dialog ----- -function CreateParamBlock(parent:HWND;x,y,width:integer;flags:dword=0):THANDLE; -function ClearParamFields(Dialog:HWND):HWND; -function FillParam (Dialog:HWND;txt:PAnsiChar):integer; -function SetParamValue (Dialog:HWND; flags:dword; value:pointer):boolean; -function GetParamValue (Dialog:HWND;var flags:dword;var value:pointer):boolean; -function SetParamLabel (Dialog:HWND; lbl:PWideChar):HWND; +function CreateParamBlock(parent:HWND;x,y,width:integer;flags:dword=0):THANDLE; stdcall; +function ClearParamFields(Dialog:HWND):HWND; stdcall; +function FillParam (Dialog:HWND;txt:PAnsiChar):integer; stdcall; +function SetParamValue (Dialog:HWND; flags:dword; value:pointer):boolean; stdcall; +function GetParamValue (Dialog:HWND;var flags:dword;var value:pointer):boolean; stdcall; +function SetParamLabel (Dialog:HWND; lbl:PWideChar):HWND; stdcall; //----- Parameter value ----- -procedure SaveParamValue( flags:dword; param:pointer; module,setting:PAnsiChar); -procedure LoadParamValue(var flags:dword; var param:pointer; module,setting:PAnsiChar); -procedure ClearParam ( flags:dword; var param); -function DuplicateParam( flags:dword; var asparam,adparam):dword; +procedure SaveParamValue( flags:dword; param:pointer; module,setting:PAnsiChar); stdcall; +procedure LoadParamValue(var flags:dword; var param:pointer; module,setting:PAnsiChar); stdcall; +procedure ClearParam ( flags:dword; var param); stdcall; +function DuplicateParam( flags:dword; var asparam,adparam):dword; stdcall; {?? function TranslateParam(param:uint_ptr;flags:dword;hContact:TMCONTACT):uint_ptr; } //----- Execution ----- -function PrepareParameter(flags:dword;const aparam:LPARAM; const data:tSubstData):LPARAM; -procedure ReleaseParameter(flags:dword;var aparam:LPARAM); +function PrepareParameter(flags:dword;const aparam:LPARAM; const data:tSubstData):LPARAM; stdcall; +procedure ReleaseParameter(flags:dword;var aparam:LPARAM); stdcall; //----- result dialog ----- -function CreateResultBlock(parent:HWND;x,y,width:integer;flags:dword=0):THANDLE; -function ClearResultFields(Dialog:HWND):HWND; -function SetResultValue (Dialog:HWND;flags:dword):integer; -function GetResultValue (Dialog:HWND):dword; +function CreateResultBlock(parent:HWND;x,y,width:integer;flags:dword=0):THANDLE; stdcall; +function ClearResultFields(Dialog:HWND):HWND; stdcall; +function SetResultValue (Dialog:HWND;flags:dword):integer; stdcall; +function GetResultValue (Dialog:HWND):dword; stdcall; //----- Old flags converting ----- -function ConvertParamFlags (flags:dword):dword; -function ConvertResultFlags(flags:dword):dword; +function ConvertParamFlags (flags:dword):dword; stdcall; +function ConvertResultFlags(flags:dword):dword; stdcall; //----- Service dialog ----- -function CreateServiceBlock(parent:HWND;x,y,width,height:integer;flags:dword=0):HWND; -procedure ClearServiceBlock (Dialog:HWND); -procedure SetServiceListMode(Dialog:HWND;mode:integer); +function CreateServiceBlock(parent:HWND;x,y,width,height:integer;flags:dword=0):HWND; stdcall; +procedure ClearServiceBlock (Dialog:HWND); stdcall; +procedure SetServiceListMode(Dialog:HWND;mode:integer); stdcall; -function SetSrvBlockValue(Dialog:HWND;const value:tServiceValue):boolean; -function GetSrvBlockValue(Dialog:HWND;var value:tServiceValue):boolean; +function SetSrvBlockValue(Dialog:HWND;const value:tServiceValue):boolean; stdcall; +function GetSrvBlockValue(Dialog:HWND;var value:tServiceValue):boolean; stdcall; // service setting for templates -procedure SetSrvBlockService(Dialog:HWND; service:PAnsiChar); -function GetSrvBlockService(Dialog:HWND):PAnsiChar; +procedure SetSrvBlockService(Dialog:HWND; service:PAnsiChar); stdcall; +function GetSrvBlockService(Dialog:HWND):PAnsiChar; stdcall; //----- ServiceValue functions ----- -procedure CopyServiceValue (var dst :tServiceValue; const src:tServiceValue); -procedure ClearServiceValue(var data:tServiceValue); -procedure SaveServiceValue (const data:tServiceValue; module,setting:PAnsiChar); -procedure LoadServiceValue (var data:tServiceValue; module,setting:PAnsiChar); +procedure CopyServiceValue (var dst :tServiceValue; const src:tServiceValue); stdcall; +procedure ClearServiceValue(var data:tServiceValue); stdcall; +procedure SaveServiceValue (const data:tServiceValue; module,setting:PAnsiChar); stdcall; +procedure LoadServiceValue (var data:tServiceValue; module,setting:PAnsiChar); stdcall; //----- Service execute ----- -function ExecuteService(const service:tServiceValue; var data:tSubstData):boolean; +function ExecuteService(const service:tServiceValue; var data:tSubstData):boolean; stdcall; {} implementation diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas index 4d16e5cf4b..dd46e411bb 100644 --- a/plugins/Utils.pas/mirutils.pas +++ b/plugins/Utils.pas/mirutils.pas @@ -49,7 +49,7 @@ implementation uses Messages, - dbsettings,freeimage, + dbsettings,//freeimage, common,io; const diff --git a/plugins/Utils.pas/sparam.pas b/plugins/Utils.pas/sparam.pas index 134fc63cae..808493f2a5 100644 --- a/plugins/Utils.pas/sparam.pas +++ b/plugins/Utils.pas/sparam.pas @@ -1,6 +1,8 @@ { Parameter: CBN_EDITCHANGE on fields changing, BN_CLICKED on Struct changes Result : CBN_EDITCHANGE on type changing, BN_CLICKED on option changes + ACF_FLAG_TEMPLATE saved in CB param of IDC_EDIT_PAR + parameter type depends of ACF_FLAG_PAR } unit sparam; @@ -206,9 +208,11 @@ var bufw:array [0..2047] of WideChar; wnd:HWND; p,pc:PAnsiChar; - ltype:dword; + flags,ltype:dword; begin wnd:=GetDlgItem(Dialog,IDC_EDIT_PAR); + flags:=CB_GetData(wnd); + CB_SetData(wnd,flags or ACF_FLAG_TEMPLATE); SendMessage(wnd,CB_RESETCONTENT,0,0); if (txt<>nil) and (txt^<>#0) then begin @@ -231,6 +235,7 @@ begin SendMessage(wnd,CB_SETCURSEL,0,0); CB_SelectData(GetDlgItem(Dialog,IDC_FLAG_PAR),result); + //!!!! need to set ACF_FLAG_TEMPLATE here FixParamControls(Dialog,result); end; @@ -490,6 +495,7 @@ begin end else begin + CB_SetData(wnd,flags and not ACF_TYPE_MASK); vtype:=flags and ACF_TYPE_MASK; case vtype of ACF_TYPE_PARAM: begin @@ -562,6 +568,8 @@ begin end; if (GetEditFlags(wnd) and EF_SCRIPT)<>0 then flags:=flags or ACF_FLAG_SCRIPT; + // for example, ACF_FLAG_TEMPLATE + flags:=flags or CB_GetData(wnd); end; //----- Parameter value ----- diff --git a/plugins/Utils.pas/srvblock.pas b/plugins/Utils.pas/srvblock.pas index ac01db8190..5ceb7a8fed 100644 --- a/plugins/Utils.pas/srvblock.pas +++ b/plugins/Utils.pas/srvblock.pas @@ -574,7 +574,7 @@ begin llparam:=PrepareParameter(service.l_flags,TLPARAM(service.lparam),data); res:=CallServiceSync(buf,lwparam,llparam); - ClearSubstData(data); +// ClearSubstData(data); DO NOT CLEAR!! (consist of input data) // result type processing case service.flags and ACF_TYPE_MASK of diff --git a/plugins/Utils.pas/syswin.pas b/plugins/Utils.pas/syswin.pas index 082e1444d5..361404cc11 100644 --- a/plugins/Utils.pas/syswin.pas +++ b/plugins/Utils.pas/syswin.pas @@ -62,7 +62,11 @@ function ExecuteWaitW(AppPath:PWideChar; CmdLine:PWideChar=nil; DfltDirectory:PW var flags: dword; {$IFDEF FPC} + {$IFDEF VER2} Startup: StartupInfo; + {$ELSE} + Startup: StartupInfoW; + {$ENDIF} {$ELSE} Startup: StartupInfoW; {$ENDIF} @@ -125,7 +129,11 @@ function ExecuteWait(AppPath:PAnsiChar; CmdLine:PAnsiChar=nil; DfltDirectory:PAn var flags: dword; {$IFDEF FPC} + {$IFDEF VER2} Startup: StartupInfo; + {$ELSE} + Startup: StartupInfoA; + {$ENDIF} {$ELSE} Startup: StartupInfoA; {$ENDIF} diff --git a/plugins/Utils.pas/wrapper.pas b/plugins/Utils.pas/wrapper.pas index c6d0c5976d..91e2f9d27e 100644 --- a/plugins/Utils.pas/wrapper.pas +++ b/plugins/Utils.pas/wrapper.pas @@ -22,7 +22,8 @@ function StringToGUID(const astr:PWideChar):TGUID; overload; // Comboboxes function CB_SelectData(cb:HWND;data:lparam):LRESULT; overload; function CB_SelectData(Dialog:HWND;id:cardinal;data:lparam):LRESULT; overload; -function CB_GetData (cb:HWND;idx:integer=-1):LRESULT; overload; +function CB_GetData (cb:HWND;idx:integer=-1):LRESULT; +function CB_SetData (cb:HWND;data:lparam;idx:integer=-1):LRESULT; function CB_AddStrData (cb:HWND;astr:PAnsiChar;data:lparam=0;idx:integer=-1):HWND; overload; function CB_AddStrData (Dialog:HWND;id:cardinal;astr:PAnsiChar;data:lparam=0;idx:integer=-1):HWND; overload; function CB_AddStrDataW(cb:HWND;astr:PWideChar;data:lparam=0;idx:integer=-1):HWND; overload; @@ -42,6 +43,7 @@ function LV_GetColumnCount(list:HWND):LRESULT; function LV_CheckDirection(list:HWND):integer; // bit 0 - can move up, bit 1 - down // CommDLG - Dialogs + function ShowDlg (dst:PAnsiChar;fname:PAnsiChar=nil;Filter:PAnsiChar=nil;open:boolean=true):boolean; function ShowDlgW(dst:PWideChar;fname:PWideChar=nil;Filter:PWideChar=nil;open:boolean=true):boolean; @@ -214,6 +216,16 @@ begin result:=SendMessage(cb,CB_GETITEMDATA,idx,0); end; +function CB_SetData(cb:HWND;data:lparam;idx:integer=-1):LRESULT; +begin + if idx<0 then + idx:=SendMessage(cb,CB_GETCURSEL,0,0); + if idx<0 then + result:=0 + else + result:=SendMessage(cb,CB_SETITEMDATA,idx,0); +end; + function CB_AddStrData(cb:HWND;astr:PAnsiChar;data:lparam=0;idx:integer=-1):HWND; begin result:=cb; -- cgit v1.2.3