Author: Rafael Cotta
I've been trying to create a MDI form without those annoying scrollbars when a
child form is moved outside main form area and I couldn't find an easy way. Setting
the scrollbars to visible := false won't work!
So, I found an example on a newsgroup... yeah! Here I show how to do it.
It's a two step proccess.
Step one : put the code below inside the OnCreate event of the main form.
1 if ClientHandle <> 0 then
3 if (not (GetWindowLong(ClientHandle, GWL_USERDATA) <> 0)) then
8 SetWindowLong(ClientHandle, GWL_WNDPROC, integer
Step two: Put this standalone function inside the unit that contains the main form,
before the OnCreate event (once OnCreate references to this function).
14 function ClientWindowProc(wnd: HWND; msg: Cardinal; wparam, lparam: Integer):
18 f: Pointer;
20 f := Pointer(GetWindowLong(wnd, GWL_USERDATA));
21 case msg of
24 if (
25 GetWindowLong(wnd, GWL_STYLE) and
26 (WS_HSCROLL or WS_VSCROLL)) <> 0 then
30 GetWindowLong(wnd, GWL_STYLE) and not
31 (WS_HSCROLL or WS_VSCROLL)
35 Result := CallWindowProc(f, wnd, msg, wparam, lparam);
The code was originally posted by Peter Below in a newsgroup (borland.public.delphi.objectpascal). I've made some little changes.