多线程菜鸟问题(100分)

  • 主题发起人 主题发起人 ruder
  • 开始时间 开始时间
R

ruder

Unregistered / Unconfirmed
GUEST, unregistred user!
program Project1;
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
mythread = class(TThread)
private
{ Private declarations }

protected
procedure Execute;
override;
public
constructor create(p:pointer);
end;


constructor mythread.create(p:pointer);
begin
inherited create(false);
end;

procedure mythread.Execute;
begin
showmessage('test');
end;

var
mythread1:mythread;
begin
mythread1:=mythread.create(nil);
showmessage('jdf');{我把这句去掉,运行就出错 }
end.

why??????????????
 
那不是出错,是因为你没有主线程,所以在创建了线程后就立即退出了。
 
后退
顶部