如何使用回调函数,请各位高手举出具体例子,大家共同参考

解决方案 »

  1.   

    implementation{$R *.dfm}
    var
      OldWindowProc : Pointer;function NewWindowProc(WindowHandle : THandle;
                           TheMessage   : LongInt;
                           ParamW       : LongInt;
                           ParamL       : LongInt) : LongInt{$IFDEF WIN32} stdcall; {$ELSE} ; export; {$ENDIF}
    begin
    { Process the message of your choice here }
      if TheMessage = WM_NCLBUTTONDBLCLK then
      begin
        ShowMessage('The vertical scrollbar is scrolling!');
        exit;
      end;{ Exit here and return zero if you want     }
    { to stop further processing of the message }{ Call the old Window procedure to }
    { allow processing of the message. }
      NewWindowProc := CallWindowProc(OldWindowProc,
                                      WindowHandle,
                                      TheMessage,
                                      ParamW,
                                      ParamL);
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
    OldWindowProc := Pointer(SetWindowLong(Handle,GWL_WNDPROC,LongInt(@NewWindowProc)));
    end;procedure TForm1.FormDestroy(Sender: TObject);
    begin
    SetWindowLong(Handle,GWL_WNDPROC,LongInt(OldWindowProc));
    end;
      

  2.   

    www.nxrs.net/bbs 
    里边有回调的详细说明;
    你可以看一看;里边有关多层的内容还行;
    卖个乖
    -------------------------------------------------------------
    寻寻寻,寻斑竹小小在线
    如果您觉的您对Delphi 感兴趣或是很想学的更好些或者是对Delphi 有更深的认识,我们可以一起交流;
    呵呵
    www.nxrs.net/bbs
    谢谢,别抛砖