Board index » delphi » What am I doing wrong...?

What am I doing wrong...?

Eh, it feels like I've missed something.

Latest bomb; the EjectTape (seen above/below)-function works, but look
at this:

rocedure TForm1.SpeedButton3Click(Sender: TObject);
begin
        showmessage('Now this works');
        showmessage(edit1.text);

        EjectTape(deDevices[strtoint(edit1.text)].HA,deDevices[strtoint(edit1.text)].ID,deDevices[strtoint(edit1.text)].LUN);

        showmessage('Now it does not');
        showmessage(edit1.text);        // new point for access
violation
end;

... did I just trick away the access violation in EjectTape by showing
up the SRB_HaStat and SRB_TargStat? Or what? I am not familiar with
these kinds of errors...

I can't either find any wild jumps in the code, but my fair guess is
that this has something to do with SendASPI32Command + unreleased
variables?

 

Re:What am I doing wrong...?


"R.C.K." <r...@mail.bip.net> skrev i melding
news:4f939c27.0212221437.42b4edfc@posting.google.com...
Quote
> Eh, it feels like I've missed something.

> Latest bomb; the EjectTape (seen above/below)-function works, but look
> at this:

> rocedure TForm1.SpeedButton3Click(Sender: TObject);
> begin
>         showmessage('Now this works');
>         showmessage(edit1.text);

EjectTape(deDevices[strtoint(edit1.text)].HA,deDevices[strtoint(edit1.text)]
.ID,deDevices[strtoint(edit1.text)].LUN);

Quote

>         showmessage('Now it does not');
>         showmessage(edit1.text);        // new point for access
> violation
> end;

> ... did I just trick away the access violation in EjectTape by showing
> up the SRB_HaStat and SRB_TargStat? Or what? I am not familiar with
> these kinds of errors...

> I can't either find any wild jumps in the code, but my fair guess is
> that this has something to do with SendASPI32Command + unreleased
> variables?

What is the declaration of EjectTape() ?
BTW, try to use a couple of variables instead of Edit1.Text:

procedure TForm1.SpeedButton3Click(Sender: TObject);
var
  TheText: string;
  TheNumber: integer;
begin
  TheText:=edit1.text;
  TheNumber:=StrToInt(RThetext);

EjectTape(deDevices[TheNumber].HA,deDevices[TheNumber].ID,deDevices[TheNumbe
r].LUN);
  showmessage('Now it does not');
  showmessage(TheText);
end;

if TheText is corrupted once you reaturn from EjectTape, it may caused by a
faulty calling convention. ('cdecl' and 'stdcall' will both provide the same
result, but if you swith them you'll have a crash afterwards).

--
Bj?rge S?ther
bjorge@hahaha_itte.no

Other Threads