A
admin2008
Unregistered / Unconfirmed
GUEST, unregistred user!
写了个dll 只有这一个过程调用后退出窗口出现Invalid pointer operation 麻烦大家帮我看下:
procedure Open_TreeNode(table_name,field,field1,all_typechar;tv:TRzTreeView);stdcall;
var
adotmp: TadoQuery;
parentNode,curNode:TTreeNode;
begin
CoInitialize(nil);
TLCYGLXT:=TTLCYGLXT.Create(nil);
adotmp:=Tadoquery.Create(nil);
adotmp.Connection:=TLCYGLXT.ADOconn ;
tv.SetFocus ;
tv.Items.Clear ;
parentNode:=tv.Items.AddChild(nil,all_type);
parentNode.ImageIndex:=0;
tv.Items.BeginUpdate ;
with adotmp do
begin
close;
sql.Clear ;
sql.Text:='select '+field+' from '+table_name+' order by '+field1+' desc';
open;
first ;
while not eof do
begin
curNode:=tv.Items.AddChildFirst(parentNode,pchar(trim(FieldByName(field).AsString)));
curNode.ImageIndex:=1;
curNode.SelectedIndex:=1;
next;
end;
end;
tv.Items.EndUpdate ;
parentNode.Expanded:=true;
adotmp.Free;
CoUninitialize;
end;
procedure Open_TreeNode(table_name,field,field1,all_typechar;tv:TRzTreeView);stdcall;
var
adotmp: TadoQuery;
parentNode,curNode:TTreeNode;
begin
CoInitialize(nil);
TLCYGLXT:=TTLCYGLXT.Create(nil);
adotmp:=Tadoquery.Create(nil);
adotmp.Connection:=TLCYGLXT.ADOconn ;
tv.SetFocus ;
tv.Items.Clear ;
parentNode:=tv.Items.AddChild(nil,all_type);
parentNode.ImageIndex:=0;
tv.Items.BeginUpdate ;
with adotmp do
begin
close;
sql.Clear ;
sql.Text:='select '+field+' from '+table_name+' order by '+field1+' desc';
open;
first ;
while not eof do
begin
curNode:=tv.Items.AddChildFirst(parentNode,pchar(trim(FieldByName(field).AsString)));
curNode.ImageIndex:=1;
curNode.SelectedIndex:=1;
next;
end;
end;
tv.Items.EndUpdate ;
parentNode.Expanded:=true;
adotmp.Free;
CoUninitialize;
end;