unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,unit2, StdCtrls;type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    Procedure   MsgcommProcess(Var   Message:Tmessage);   Message   Wm_commnotify;
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;const
  Wm_commNotify=Wm_User+12;
implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
  Comthread.Create(false);
end;procedure TForm1.MsgcommProcess(var Message : TMessage);
begin
  showmessage('A');
end;
end.unit Unit2;interfaceuses
  Classes,Windows,Messages;type
  Comthread = class(TThread)
  private
    { Private declarations }
  protected
    procedure Execute; override;
  end;implementationuses unit1;
procedure Comthread.Execute;
begin   PostMessage(Form1.Handle,WM_COMMNOTIFY,0,0);
end;end.

解决方案 »

  1.   

    procedure Comthread.Execute; 
    begin 
     showmessage('Send'); 
      PostMessage(Form1.Handle,WM_COMMNOTIFY,0,0); 
    end; 有沒有  send;
      

  2.   

    unit Unit1; interface uses 
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
      Dialogs,unit2, StdCtrls; 
    const 
      Wm_commNotify=Wm_User+12;   // 放到這裏來type 
      TForm1 = class(TForm) 
        Button1: TButton; 
        procedure Button1Click(Sender: TObject); 
      private 
        Procedure  MsgcommProcess(Var  Message:Tmessage);  Message  Wm_commnotify; 
        { Private declarations } 
      public 
        { Public declarations } 
      end; var 
      Form1: TForm1; 
    implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); 
    begin 
      Comthread.Create(false); 
    end; procedure TForm1.MsgcommProcess(var Message : TMessage); 
    begin 
      showmessage('A'); 
    end; 
    end. unit Unit2; interface uses 
      Classes,Windows,Messages; type 
      Comthread = class(TThread) 
      private 
        { Private declarations } 
      protected 
        procedure Execute; override; 
      end; implementation uses unit1; 
    procedure Comthread.Execute; 
    begin   PostMessage(Form1.Handle,WM_COMMNOTIFY,0,0); 
    end; end.
      

  3.   

    wm_commnotify好像是系统消息, 你又定义了一遍,去掉二次定义,或用3楼的方法试试