Registriert seit: 13. Feb 2007
306 Beiträge
Delphi 7 Enterprise
|
Re: Clientsocket NonVcl create
27. Sep 2008, 17:32
neues problem: ich bekomme eine speicherverletzung
Delphi-Quellcode:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TField = class
constructor Create(Owner: TComponent);
destructor destroy;
private
Fields: array[0..7] of array[0..7] of TShape;
end;
type
TForm1 = class(TForm)
Button1: TButton;
Shape1: TShape;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
Field:TField;
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
destructor TField.destroy;
begin
Fields[0,0].Free;
end;
constructor TField.Create(Owner: TComponent);
var i,k:integer;
begin
inherited Create;
Fields[0,0]:=TShape.Create(Owner); //test --->Fehler
{for i:=0 to 7 do
for k:=0 to 7 do begin
Fields[i,k]:=TShape.Create(Form1);
with Fields[i,k] do begin
Parent:=Form1;
Width:=20;
Height:=20;
Left:=i*20;
Top:=k*20;
Brush.Color:=clGray;
end;
end; }
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Field.Create(self);
end;
end.
"Never touch a running system administrator !"
|
|
Zitat
|