To use a bitmap or other graphics in the client space of MDI forms,
the only trick is getting the hWnd for that window so that you can use
GDI functions on it. The key is understanding that the client space is
the first child (in Windows-speak, not MDI-speak) of the MDI form.
Get the handle via the GetWindow API call with the GW_CHILD constant.
You create a MDIForm_Paint event with a subclassing control such as MsgHook
from
Visual Basic How To, Second Edition by Zane Thomas, Robert
Arnson, and Mitchell Waite (Waite Group Press). When the WM_PAINT message
is intercepted, call your routines to BitBlt a BMP or draw other graphics
in the client space. When WM_ERASEBKGND message is intercepted, prevent
it from being passed on to VB (all subclassing controls use slightly different
terminology for this). If you're using MsgHook, put the statements below
in the MDI form's Form_Load event. To see this and other MDI techniques
in action, download MDIDMO.ZIP from either the MSBASIC or VBPJ forums on
CompuServe and try out the demonstrations.
MsgHook1.HwndHook = (GetWindow(Me.hWnd, GW_CHILD))
MsgHook1.Message(WM_PAINT) = True
MsgHook1.Message(WM_ERASEBKGND) = True
Karl E.