Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Exe auf eigenem Panel (https://www.delphipraxis.net/131386-exe-auf-eigenem-panel.html)

hanspeter 24. Mär 2009 08:29


Exe auf eigenem Panel
 
Hallo,
ich hänge bei meinem Plugin-System mal wieder an einer Kleinigkeit.
Mit nachfolgender Sequenz weise ich einer gestarteten Exe ein Panel als Parent zu.

Delphi-Quellcode:
Wnd := MainWindowHandle(ExeName);
  if Wnd <>0 then
  begin
    Windows.SetParent(Wnd,aParent.Handle);
    SetWindowLong(wnd,GWL_STYLE,(GetWindowLong(wnd,GWL_STYLE) AND NOT WS_CAPTION) or WS_CHILD);
    WPM.Length:=SizeOf(WPM);
    GetWindowPlacement(Wnd,@WPM);
    WPM.ShowCmd:=SW_ShowMaximized;
    WPM.rcNormalPosition:=Classes.Rect(0,0,aParent.Width,aParent.Height);
    SetWindowPlacement(Wnd,@WPM);
    end;
MainWindowHandle ist eine eigene Funktion und bestimmt das Handle des sichtbaren Fensters in meinem Plugin.
Das funktioniert auch.
Allerdings sind alle Komponenten im Fenster des eingeblendeten Plugin readonly.
Das Fenster kann keinen Focus erhalten.
Was mache ich falsch?

Mit Gruß
Peter

hanspeter 24. Mär 2009 10:46

Re: Exe auf eigenem Panel
 
Interessant,
wenn ich den Parent in der Kommandozeile übergebe und die gleiche Sequenz auf der Plugin-Seite
abarbeite, dann geht es.

Jetzt auf der Clientseite.

Delphi-Quellcode:
procedure SetClientParent(wnd, Parent: THandle);
var
  WPM : TWindowPlacement;
  w,h : integer;
begin
  Windows.SetParent(wnd, Parent);
  SetWindowLong(wnd,GWL_STYLE,(GetWindowLong(wnd,GWL_STYLE) AND NOT WS_CAPTION) or WS_CHILD);
  WPM.Length:=SizeOf(WPM);
  GetWindowPlacement(Parent,@WPM);
  w := wpm.rcNormalPosition.right - wpm.rcNormalPosition.left;
  h := wpm.rcNormalPosition.bottom - wpm.rcNormalPosition.top;
  WPM.ShowCmd:=SW_ShowMaximized;
  WPM.rcNormalPosition:=Classes.Rect(0,0,w,h);
  SetWindowPlacement(wnd,@WPM);
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 20:27 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz