How COM this won't work?
This one's got me going.
In the method below, the commented line causes all sorts of grief. If I
uncomment it, I raise a "Catastrophic Failure" exception in NT4 and an
"Unexpected Failure" exception in W98 (I guess W98 is a little kinder
and gentler about these things :-))
Anyway. If I comment the line, as shown, the ShowMessage line just
below executes and no exception is raised. The code in the except block
is never executed.
To make matters worse, even though the code in this method executes
(assuming the defective line is commented), I can't hit a breakpoint in
the method - Not even the very first line in the method.
One more problem arises when I try to debug the procedure by inserting
code to display a form, called frmDebug, which has a memo component on
it. All goes well, till I call frmDebug.showModal. The form never
shows up and I am returned to the Delphi IDE. The form of the app which
calls this method remains on the screen and appears to have focus, but I
cannot press any of the buttons on it. Nor can I close it with the
system button in the upper right corner.
Questions:
1. What is a Catastrophic Failure?
How can I debug it?
2. How come I can't hit my breakpoints?
3. How come I can't ShowModal my frmDebug?
procedure TRhinoHull.CalculateHydrostatics;
var
i,j : integer;
v : double; //cumulative volume
begin
v := 0;
//for each part
for i := 0 to fParts.Count-1 do begin //fParts is a tInterfaceList
rPart := iRhinoPart(fParts.items[i]);
//for each component and its shape
for j := 0 to IInterfaceList(rPart.Components).count-1 do begin
//Components is a tInterfaceList
rComp :=
iRhinoComponent(iInterfaceList(rPart.Components).items[j]);
rShp := rComp.Shape;
if rShp <> nil then begin
if fDraft <> '' then rShp.Waterline := StrToFloat(fDraft);
try
// v := rShp.Volume; <--- This is the {*word*81} which
raises cain.
ShowMessage ('Calculating Hydrostatics'); <--- This executes if the prev
line commented.
except
on e:exception do begin
Showmessage ('Error: ' + e.message); <---This does
not execute, even when exception raised.
end;
end;
end; //if rShp <> nil then
end; //for j
end; //for i
end;//procedure TRhinoHull.CalculateHydrostatics
--
Cheers,
**********************************************************************
*** Cliff W. Estes ces...@basline.com ***
*** BaseLine Technology ph (425)882-7317 ***
*** 15834 NE 67th Place fax (425)882-7327 ***
*** Redmond, WA 98052 http://www.basline.com/ ***
**********************************************************************
Quality Marine Fairing, Modeling and Rendering
http://www.basline.com/imggal.shtm