FIX: Push correct window handle to plugins (Qt5)

This commit is contained in:
Alexander Koblov 2021-10-26 18:31:10 +03:00
commit 72ca6065fd
3 changed files with 17 additions and 4 deletions

View file

@ -117,7 +117,8 @@ procedure ShowOpenWithDialog(TheOwner: TComponent; const FileList: TStringList);
{$ENDIF}
function GetControlHandle(AWindow: TWinControl): HWND;
function GetWindowHandle(AWindow: TWinControl): HWND;
function GetWindowHandle(AWindow: TWinControl): HWND; overload;
function GetWindowHandle(AHandle: HWND): HWND; overload;
implementation
@ -892,6 +893,17 @@ begin
end;
{$ENDIF}
function GetWindowHandle(AHandle: HWND): HWND;
{$IF DEFINED(MSWINDOWS) and DEFINED(LCLQT5)}
begin
Result:= Windows.GetAncestor(HWND(QWidget_winId(TQtWidget(AHandle).GetContainerWidget)), GA_ROOT);
end;
{$ELSE}
begin
Result:= AHandle;
end;
{$ENDIF}
{$IF DEFINED(UNIX) AND NOT DEFINED(DARWIN)}
procedure ShowOpenWithDialog(TheOwner: TComponent; const FileList: TStringList);
begin

View file

@ -189,7 +189,7 @@ uses
SysConst, LazUTF8, FileUtil,
//DC
uDCUtils, uComponentsSignature, uGlobsPaths, uLng, uOSUtils, DCOSUtils,
uDCUtils, uComponentsSignature, uGlobsPaths, uLng, uOSUtils, DCOSUtils, uOSForms,
DCDateTimeUtils, DCConvertEncoding, fDialogBox, uDebug, uShowMsg, uLog, uGlobs;
const
@ -564,7 +564,7 @@ end;
procedure TWcxModule.VFSConfigure(Parent: HWND);
begin
if Assigned(ConfigurePacker) then
ConfigurePacker(Parent, FModuleHandle);
ConfigurePacker(GetWindowHandle(Parent), FModuleHandle);
end;
function TWcxModule.ReadWCXHeader(hArcData: TArcHandle;

View file

@ -192,7 +192,7 @@ uses
//DC
uDCUtils, uLng, uGlobsPaths, uOSUtils, uWfxPluginUtil, fDialogBox, DCOSUtils,
DCStrUtils, DCConvertEncoding, uComponentsSignature;
DCStrUtils, DCConvertEncoding, uComponentsSignature, uOSForms;
const
WfxIniFileName = 'wfx.ini';
@ -298,6 +298,7 @@ var
pwcRemoteName: PWideChar;
begin
Result:= WFX_NOTSUPPORTED;
MainWin:= GetWindowHandle(MainWin);
if Assigned(FsExecuteFileW) then
begin
pwcRemoteName:= GetMem(MAX_PATH * SizeOf(WideChar));