各位大侠,小弟手头有一段代码,可不明其理,故请大家伸出援助之手,帮小第一把。不知能不能给小弟加加注释,说说函数用法?不胜感激!
代码如下:
应用于mdi程序中,这段代码是主窗口中的。
unit fm_main;
...
...
  private
    FClientInstance,fPrevClientProc: TFarProc;
    PROCEDURE ClientWndProc(VAR Message: TMessage);
...
implementation
procedure Tmainfm.clientwndproc(var message: tmessage);
VAR
  MyDC : hDC;
  cr:TRect;
begin
  with Message do
  begin
    case Msg of
      WM_ERASEBKGND:
      begin
        MyDC := TWMEraseBkGnd(Message).DC;
        getwindowrect(clienthandle,cr);
        stretchblt(mydc,0,0,cr.right,cr.bottom-45,
                   Image1.Picture.Bitmap.Canvas.Handle,
                   0,0,Image1.Picture.Width,Image1.Picture.Height,
                   SRCCOPY);
        Result := 1;
      end;
    else
      Result := CallWindowProc(FPrevClientProc,
                               ClientHandle,
                               Msg,
                               wParam,
                               lParam);   
    end;
  end;
end;procedure Tmainfm.FormCreate(Sender: TObject);
begin
  FClientInstance := MakeObjectInstance(ClientWndProc);
  FPrevClientProc := Pointer(GetWindowLong(ClientHandle,
                      GWL_WNDPROC));
  SetWindowLong(ClientHandle,
                GWL_WNDPROC,
                LongInt(FClientInstance));
end;