Options

cfront.dll + SetExceptionHandler + delphi

elite001elite001 Member Posts: 12
hello,
first, sorry for my english..=(
i tried write a program that imports *.fob files to database.. but i cant to call exception function... exception raises after message about error..8-(
4ex: exp.fob is 0 bytes, when i try to import a file, first, the program "says" that 'the file is not FOB', then an exception is thrown, and drops into debugger.
How to make it work?

[DELPHI/LAZARUS]
type
PVoid       = pointer;
TDBL_S32    = longint;
TDBL_BOOL   = longbool;
TDBL_pFuncExceptionHandler = procedure(ErrorCode: TDBL_S32; IsFatal: TDBL_BOOL) of object;
function  DBL_SetExceptionHandler(ExceptionHandler:TDBL_pFuncExceptionHandler):PVoid; cdecl;external 'cfront.dll';
[...]
implementation
[...]
procedure myhandler(ErrorCode: TDBL_S32; IsFatal: TDBL_BOOL) cdecl;
var
  e:string;
begin
  raise Exception.Create(e);
  showmessage(e);
end; 
[...]
procedure TForm1.KOLForm1FormCreate(Sender: PObj);
var
  myhandler: TDBL_pFuncExceptionHandler;
begin
  DBL_Init;
  DBL_SetExceptionHandler(myhandler);    
  try
[...]
DBL_ImportFOB(FOBPath,1); //it works if the file is normaly exported
[...]
many thanks =)

Comments

  • Options
    elite001elite001 Member Posts: 12
    Yep.. im dummy))))
    ..drops into debugger.. it's normal.. if program run by clicking exe file, exceptions are handled perfectly...
    to hide program's messages about any error (before exception catched) i used
    DBL_HideMessageShowHandler(true);
    

    thanks XD
Sign In or Register to comment.