Вниз
Скачать: CL | DM;

Вопрос по Thread, мож кто прояснит в чём дело...   Найти похожие ветки 

← →
_Agent_   (2003-10-30 13:32) [0]

форма, на ней кнопка. Код проги:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TMyThread = class(TThread)
private
FA : Integer;
protected
procedure Execute; override;
public
constructor Create(a:integer);
end;
var
Form1: TForm1;
My: TMyThread;
implementation
{$R *.dfm}
constructor TMyThread.Create(a:integer);
begin
inherited Create(True);
FreeOnTerminate := True;
FA:=a;
resume;
end;
procedure TMyThread.Execute;
begin
ReturnValue:=FA;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
If not Assigned(My) then My.Create(3)else My.Terminate;
end;
end.
при нажатии кнопки выдаёт ошибку доступа к памяти. Почему?
заранее благодарен :)))


← →
icWasya ©   (2003-10-30 13:45) [1]

ну во первых не
My.Create(3)
а
My:=TMyThread.Create(3)


← →
_Agent_   (2003-10-30 13:50) [2]

Величайшее спасибо ..
мой косяк
недогледел :))))



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.02 c
4-42275
samson
2003-09-12 08:15
2003.11.13
очередь сообщений Windows


4-42308
AlexSSS
2003-09-07 13:54
2003.11.13
Temp


1-41483
Deedlit
2003-10-28 18:04
2003.11.13
Где я? StringGrid


3-41010
Piton X
2003-10-14 13:44
2003.11.13
Запрос об оплате услуг по датам. Строки - люди, столбцы - даты, а


1-41537
Brenton
2003-10-28 04:52
2003.11.13
Проблема с копированием файлов... помогите пожалуйста




   Наверх