S
SamHunt
Unregistered / Unconfirmed
GUEST, unregistred user!
我写了一个DLL是关于数据库的,调用正常,但是调用程序关闭的时候就出现指针出错!
'Invalid pionter operation'
请各位指点一下?
//Dll Code
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
dxTL, dxDBCtrl, wwSpeedButton, wwDBNavigator, ExtCtrls, wwclearpanel,
dxCntner, dxDBTL, Db, ADODB, Grids, Wwdbigrd, Wwdbgrid, dxDBGrid,
ComCtrls;
type
TFJiLiang = class(TForm)
ADOTable1: TADOTable;
DataSource1: TDataSource;
dxDBGrid1: TdxDBGrid;
dxDBGrid1UnitID: TdxDBGridMaskColumn;
dxDBGrid1UnitName: TdxDBGridMaskColumn;
wwDBNavigator1: TwwDBNavigator;
wwDBNavigator1First: TwwNavButton;
wwDBNavigator1PriorPage: TwwNavButton;
wwDBNavigator1Prior: TwwNavButton;
wwDBNavigator1Next: TwwNavButton;
wwDBNavigator1NextPage: TwwNavButton;
wwDBNavigator1Last: TwwNavButton;
wwDBNavigator1Insert: TwwNavButton;
wwDBNavigator1Delete: TwwNavButton;
wwDBNavigator1Edit: TwwNavButton;
wwDBNavigator1Post: TwwNavButton;
wwDBNavigator1Cancel: TwwNavButton;
procedure dxDBGrid1DblClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FJiLiang: TFJiLiang;
Function UnitTable(Var AUnitName,AUnitID:String):WordBool;export;
implementation
{$R *.DFM}
procedure TFJiLiang.dxDBGrid1DblClick(Sender: TObject);
begin
ModalResult :=mrok;
end;
Function UnitTable(Var AUnitName,AUnitID:String):WordBool;export;
var
FJiLiang: TFJiLiang;
begin
Result:=false;
FJiLiang:=TFJiLiang.create(Application);
Try
if FJiLiang.ShowModal = mrok then
with FJiLiang do
begin
AUnitID:=dxDBGrid1.Items[dxDBGrid1.FocusedNode.Index].Strings[0];
AUnitName:=dxDBGrid1.Items[dxDBGrid1.FocusedNode.Index].Strings[1];
Result :=true;
end;
finally
FJiLiang.Free;
end;
end;
procedure TFJiLiang.FormCreate(Sender: TObject);
begin
ADOTable1.Active:=true;
end;
end.
//调用的程序编码
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
Function UnitTable(Var AUnitName,AUnitID:String):WordBool;far;External 'JiLianDanWei.dll';
procedure TForm1.Button1Click(Sender: TObject);
var
TempA,TempB:string;
begin
TempA:='';
TempB:='';
if UnitTable(TempA,TempB) Then
Begin
button1.Caption:=TempA;
// Button2.Caption:=TempB;
end;
end;
end.
'Invalid pionter operation'
请各位指点一下?
//Dll Code
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
dxTL, dxDBCtrl, wwSpeedButton, wwDBNavigator, ExtCtrls, wwclearpanel,
dxCntner, dxDBTL, Db, ADODB, Grids, Wwdbigrd, Wwdbgrid, dxDBGrid,
ComCtrls;
type
TFJiLiang = class(TForm)
ADOTable1: TADOTable;
DataSource1: TDataSource;
dxDBGrid1: TdxDBGrid;
dxDBGrid1UnitID: TdxDBGridMaskColumn;
dxDBGrid1UnitName: TdxDBGridMaskColumn;
wwDBNavigator1: TwwDBNavigator;
wwDBNavigator1First: TwwNavButton;
wwDBNavigator1PriorPage: TwwNavButton;
wwDBNavigator1Prior: TwwNavButton;
wwDBNavigator1Next: TwwNavButton;
wwDBNavigator1NextPage: TwwNavButton;
wwDBNavigator1Last: TwwNavButton;
wwDBNavigator1Insert: TwwNavButton;
wwDBNavigator1Delete: TwwNavButton;
wwDBNavigator1Edit: TwwNavButton;
wwDBNavigator1Post: TwwNavButton;
wwDBNavigator1Cancel: TwwNavButton;
procedure dxDBGrid1DblClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FJiLiang: TFJiLiang;
Function UnitTable(Var AUnitName,AUnitID:String):WordBool;export;
implementation
{$R *.DFM}
procedure TFJiLiang.dxDBGrid1DblClick(Sender: TObject);
begin
ModalResult :=mrok;
end;
Function UnitTable(Var AUnitName,AUnitID:String):WordBool;export;
var
FJiLiang: TFJiLiang;
begin
Result:=false;
FJiLiang:=TFJiLiang.create(Application);
Try
if FJiLiang.ShowModal = mrok then
with FJiLiang do
begin
AUnitID:=dxDBGrid1.Items[dxDBGrid1.FocusedNode.Index].Strings[0];
AUnitName:=dxDBGrid1.Items[dxDBGrid1.FocusedNode.Index].Strings[1];
Result :=true;
end;
finally
FJiLiang.Free;
end;
end;
procedure TFJiLiang.FormCreate(Sender: TObject);
begin
ADOTable1.Active:=true;
end;
end.
//调用的程序编码
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
Function UnitTable(Var AUnitName,AUnitID:String):WordBool;far;External 'JiLianDanWei.dll';
procedure TForm1.Button1Click(Sender: TObject);
var
TempA,TempB:string;
begin
TempA:='';
TempB:='';
if UnitTable(TempA,TempB) Then
Begin
button1.Caption:=TempA;
// Button2.Caption:=TempB;
end;
end;
end.