本篇文章主要介绍了"Delphi之多线程实例",主要涉及到Application方面的内容,对于Delphijrs看球网直播吧_低调看直播体育app软件下载_低调看体育直播感兴趣的同学可以参考一下:
其他的我也就不多说了,说也说不好,再说这个东东因为暂时没有完全搞懂所以也不好说!之就给代码吧program TestThread;uses Forms, M...
其他的我也就不多说了,说也说不好,再说这个东东因为暂时没有完全搞懂所以也不好说!之就给代码吧
program TestThread;
uses
Forms,
Main in 'Main.pas' {Form1},
TstThrd in 'TstThrd.pas';
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
===============工程文件结束===============
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Mask, TstThrd;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Image1: TImage;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
newThread: TTstthread;
begin
newThread := TTstThread.Create(False);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Image1.Picture.LoadFromFile(ExtractFilePath(Application.ExeName) + '0.bmp');
end;
end.
===================Main.Pas结束================
unit TstThrd;
interface
uses
Classes;
type
TTstThread = class(TThread)
private
{ Private declarations }
Answer: integer;
protected
procedure GiveAnswer;
procedure Execute; override;
end;
implementation
uses SysUtils, Main;