在Delphi中自定义一个窗口过程,如何调用它??
是否有哪位大虾给偶讲讲窗口过程的作用

解决方案 »

  1.   

    KAO,真正的初学者!我只会做,不会说
      

  2.   

    可能要看看windows程序设计的书
      

  3.   

    窗口过程直接调用就行了,不过他是在本单元公用,其他单元不能调用的
    直接写实现过程:
    procedure aa(参数);
    begin
    end;
    如果时成员函数,则是(需要提前申明):
    procedure 所在类(如TForm1).aa(参数);
    begin
    end;
      

  4.   

    unit Unit1; interface uses 
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
      StdCtrls; type 
      TForm1 = class(TForm) 
        procedure FormCreate(Sender: TObject); 
      private 
        { Private declarations } 
      public 
        { Public declarations }
         procedure WndProc(var Message : TMessage); override; //自定义窗口过程
      end; var 
      Form1: TForm1; implementation {$R *.DFM} { TURLLabel } procedure TForml.WndProc(var Message: TMessage); 
    begin 
      if (Message.Msg = CM_MOUSELEAVE) then //处理消息
      begin 
        Font.Color := clWindowText; 
        Font.Style := Font.Style - [fsUnderline]; 
      end; 
      inherited WndProc(Message); 
    end; 
    end.
      

  5.   

    窗口过程主要用来捕获并处理应用程序发往该窗口的消息。
    当windows提供的标准消息处理函数不足以满足我们的要求的时候就需要我们自己编写并覆盖(override) WndProc,这样的一个过程也称为“子类化”。
    想要清楚的了解窗口过程,建议你看看DDG5和InSide VCL
      

  6.   

    窗口过程是用来处理application发给自己需要处理的消息
    如果你需要用自己定义的窗口过程
    把mainform.WindowProc:=你自己定义的窗口过程
    这样就可以了