usendmessagethread.pas

来自「这是不可多得的源代码」· PAS 代码 · 共 42 行

PAS
42
字号
unit uSendMessageThread;

interface

uses
  Classes, Windows, Controls;

type
  TSendMessage = class(TThread)
  private
    { Private declarations }
  protected
    procedure Execute; override;
  end;

implementation

uses fmMain;

{ Important: Methods and properties of objects in visual components can only be
  used in a method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

    procedure SendMessage.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ SendMessage }

procedure TSendMessage.Execute;
begin
  { Place thread code here }
  while (not Terminated) do
    SendMessage(Form1.btnTriiger.Handle, CN_COMMAND, 0, 0);
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?