function SetParent(hWndChild, hWndNewParent: HWND; NewParentWidth,
NewParentHeight: integer): boolean;
var
hWndPrevParent: HWND;
PrefWindowLong: DWORD;
begin
hWndPrevParent := Windows.SetParent(hWndChild, hWndNewParent);
if hWndPrevParent = 0
then
raise exception.create('
ERROR: SetParent failed!');
//-- Rahmen entfernen
PrefWindowLong := SetWindowLong(hWndChild, GWL_STYLE,
GetWindowLong(hWndChild ,GWL_STYLE)
and WS_BORDER);
if PrefWindowLong = 0
then
raise exception.create('
ERROR: PrefWindowLong(1)');
//-- Titelmenü entfernen
PrefWindowLong := SetWindowLong(hWndChild, GWL_STYLE,
GetWindowLong(hWndChild,GWL_STYLE)
and not WS_CAPTION);
if PrefWindowLong = 0
then
raise exception.create('
ERROR: PrefWindowLong(2)');
//- Auf Paranet skalieren
if not SetWindowPos(hWndChild, 0 ,0, 0, 0, 0, SWP_NOSIZE
or
SWP_NOMOVE
or SWP_NOZORDER
or SWP_FRAMECHANGED)
then
raise exception.create('
ERROR: PrefWindowLong(3)');
//-- Neu zeichnen
if not SetWindowPos(hWndChild, 0, 0, 0, NewParentWidth,
NewParentHeight, SWP_NOZORDER
or SWP_SHOWWINDOW)
then
raise exception.create('
ERROR: PrefWindowLong(4)');
result := true;
end;