Re: Dll Project with ADO



lzq formulated on Πέμπτη :
I create a dll project under Delphi . I write a exports function like this
function ReportOut(Handle:HWND):DWORD;stdcall;
begin
ShowMessage('Begin Test !');
Report.QReport:=TQReport.CreateParented(Handle);
Report.QReport.Preview;
ShowMessage('End Test !');
Result:=0;
end;
exports ReportOut;
and I call this function under Visual C++.
at first I create a window and use this window's HWND as parameter .
It works.
but if I add a ADO controls such as ADOConnection or ADOQuery to
TQReport(a QuickReport controls) It cann't work when I call this
function,It says there is a Unhandled exception . I don't know how the
ADO controls works . I just guess if the ADO controls can not use 'heap'
when the VC program call this function .
Could you help me ,thanks!

Try calling CoInitialize before create the TQReport and CoUninitialize after the Result := 0; line of code.

Regards
Yannis.

--
In the end, everything is a gag.
- Charlie Chaplin (1889-1977)


.