狸
狸猫
Unregistered / Unconfirmed
GUEST, unregistred user!
我在DLL中写了如下一个函数。
function TestQuery(aHandle : THandle;var aDirect : String) : String;StdCall;
; var query1 : TQuery;
begin
; Application.Handle := aHandle;
; query1 := TQuery.Create(Application);
; with query1 do
; begin
; ; DatabaseName := aDirect;
; ; Sql.Text := 'Select * from sydflds';
; ; Prepare;
; ; Open;
; end;
; with query1 do
; begin
; ; Close;
; ;// Free;
; end;
; Result := 'OK';
end;
调用程序如下
function TestQuery(aHandle : THandle;var aDirect : String) : String;StdCall;external 'test.dll';
procedure TForm1.Button1Click(Sender: TObject);
; var ls, a : String;
begin
; a := './sy';
; ls := TestQuery(Application.Handle,a);
; Showmessage(ls);
end;
运行是出现"Invalid pointer operation"的错误。
请问是什么原因?
function TestQuery(aHandle : THandle;var aDirect : String) : String;StdCall;
; var query1 : TQuery;
begin
; Application.Handle := aHandle;
; query1 := TQuery.Create(Application);
; with query1 do
; begin
; ; DatabaseName := aDirect;
; ; Sql.Text := 'Select * from sydflds';
; ; Prepare;
; ; Open;
; end;
; with query1 do
; begin
; ; Close;
; ;// Free;
; end;
; Result := 'OK';
end;
调用程序如下
function TestQuery(aHandle : THandle;var aDirect : String) : String;StdCall;external 'test.dll';
procedure TForm1.Button1Click(Sender: TObject);
; var ls, a : String;
begin
; a := './sy';
; ls := TestQuery(Application.Handle,a);
; Showmessage(ls);
end;
运行是出现"Invalid pointer operation"的错误。
请问是什么原因?