unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 =
class(TForm)
procedure FormCreate(Sender: TObject);
Function ClientWindowProc( wnd: HWND; msg: Cardinal; wparam,
lparam: Integer ): Integer;
stdcall;
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
If ClientHandle <> 0
Then Begin
If GetWindowLong( ClientHandle, GWL_USERDATA ) <> 0
Then
Exit;
// cannot subclass client window, userdata already in use
SetWindowLong( ClientHandle, GWL_USERDATA,
SetWindowLong( ClientHandle, GWL_WNDPROC,
integer( @ClientWindowProc)));
End;
end;
Function ClientWindowProc( wnd: HWND; msg: Cardinal; wparam,
lparam: Integer ): Integer;
stdcall;
Var
f: Pointer;
Begin
f:= Pointer( GetWindowLong( wnd, GWL_USERDATA ));
Case msg
of
WM_NCCALCSIZE:
Begin
If ( GetWindowLong( wnd, GWL_STYLE )
and
(WS_HSCROLL
or WS_VSCROLL)) <> 0
Then
SetWindowLong( wnd, GWL_STYLE,
GetWindowLong( wnd, GWL_STYLE )
and not (WS_HSCROLL
or WS_VSCROLL));
End;
End;
Result := CallWindowProc( f, wnd, msg, wparam, lparam );
End;
end.