Hi Guys,
I'm using the following code to read some info from a file into a Memo Box and then write new info from the Memo Box back to the file. The read portion under Form Activate works OK but when I attempt to write using the 'EdtLgOkBtnClick' procedure I get an, "Access Violation" error. Any thoughts on how to cure this would be appreciated.
procedure TEdtLgFrm.FormActivate(Sender: TObject);
var
val : Integer;
RecINFO : INFO;
i : Integer;
StrArray : Array[0..40] of Char;
PStrArray : PChar;
begin
PStrArray := @StrArray;
EdtLgMb.Clear;
for i := 0 to 7 do
begin
read_options(@RecINFO);
Move(RecInfo.Logo[i,0],StrArray[0],41);
EdtLgMb.Lines.Add(string(PStrArray));
end;
end;
procedure TEdtLgFrm.EdtLgOkBtnClick(Sender: TObject);
var
RecINFO : INFO;
i : Integer;
StrArray : Array[0..40] of Char;
PStrArray : PChar;
begin
if EdtLgMb.Lines.Text = '' then
begin
ShowMessage('Please Enter New Logo Information or Press EXIT');
Exit;
end
else
read_options(@RecINFO);
EdtLgMb.Lines.Add(string(PStrArray));
Move(RecInfo.Logo[i,0],StrArray[0],41);
write_options(@RecINFO);
end;
end.
I'm using the following code to read some info from a file into a Memo Box and then write new info from the Memo Box back to the file. The read portion under Form Activate works OK but when I attempt to write using the 'EdtLgOkBtnClick' procedure I get an, "Access Violation" error. Any thoughts on how to cure this would be appreciated.
procedure TEdtLgFrm.FormActivate(Sender: TObject);
var
val : Integer;
RecINFO : INFO;
i : Integer;
StrArray : Array[0..40] of Char;
PStrArray : PChar;
begin
PStrArray := @StrArray;
EdtLgMb.Clear;
for i := 0 to 7 do
begin
read_options(@RecINFO);
Move(RecInfo.Logo[i,0],StrArray[0],41);
EdtLgMb.Lines.Add(string(PStrArray));
end;
end;
procedure TEdtLgFrm.EdtLgOkBtnClick(Sender: TObject);
var
RecINFO : INFO;
i : Integer;
StrArray : Array[0..40] of Char;
PStrArray : PChar;
begin
if EdtLgMb.Lines.Text = '' then
begin
ShowMessage('Please Enter New Logo Information or Press EXIT');
Exit;
end
else
read_options(@RecINFO);
EdtLgMb.Lines.Add(string(PStrArray));
Move(RecInfo.Logo[i,0],StrArray[0],41);
write_options(@RecINFO);
end;
end.