各位大侠,好象还是老问题啊。只是这次调用的时候没出错,程序退出的时候才出错的。
想来想去还是把源代码拉上来麻烦各位看看
库代码
unit VerifyPass;
interface
uses
ShareMem, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DateUtils;
//中间一些代码就删了
var
Form1: TForm1;
function VP(sPppoe:Integer):AnsiString;Stdcall;
implementation
{$R *.dfm}
function VP(sPppoe:Integer):AnsiString;Stdcall;
var
year,month,day,hour,minute,second,msecond:Word;
sVer:Integer;
begin
Result:='';
DecodeDateTime(Now,year,month,day,hour,minute,second,msecond);
sVer:=year+month+day+hour+minute+second+msecond;
if sPppoe<>sVer then
Result:='Provider=MSDAORA.1;Password=123;User ID=PLH;Data Source=p41600;Persist Security Info=True'
else
Result:='44332';
end;
end.
调用程序代码
unit Unit1;
interface
uses
ShareMem, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DateUtils;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
function VP(sPppoe:Integer):AnsiString;Stdcall;external 'Orapub.DLL';
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Sum,year,month,day,hour,minute,second,msecond:Word;
LibHandle:THandle;
begin
try
LibHandle := LoadLibrary('Orapub.DLL');
if LibHandle<>0 then
begin
DecodeDateTime(Now,year,month,day,hour,minute,second,msecond);
Sum:=year + month + day + hour + minute + second + msecond;
Label1.Caption:=VP(Sum);
end
else
Application.MessageBox(' 动态连接库加载失败! ','错误',MB_OK+MB_ICONSTOP);
finally
FreeLibrary(LibHandle);
end;
end;
end.