请教,我该如何调用该 DLL ?(100分)

  • 主题发起人 主题发起人 xf163
  • 开始时间 开始时间
X

xf163

Unregistered / Unconfirmed
GUEST, unregistred user!
我用 exec 另存的 login.dll 如下:
Dispatch _Login;
GUID={56CBA7EA-CE2B-4749-88AB-D2CF793E2647};
function QueryInterface(riid:^GUID
out ppvObj:^^void);
function AddRef: UI4;
function Release: UI4;
function GetTypeInfoCount(out pctinfo:^UINT);
function GetTypeInfo(itinfo:UINT
lcid:UI4
out pptinfo:^^void);
function GetIDsOfNames(riid:^GUID
rgszNames:^^I1
cNames:UINT
lcid:UI4
out rgdispid:^I4);
function Invoke(dispidMember:I4
riid:^GUID
lcid:UI4
wFlags:UI2
pdispparams:^DISPPARAMS
out pvarResult:^variant
out pexcepinfo:^EXCEPINFO
out puArgErr:^UINT);
property-get cServer: variant;
property-put cServer(variant);
property-put ProcessId(^I4);
function RemoteExec(out cCmd:^BSTR): variant;
property-get LanguageID: I4;
property-get cUserPassWord: BSTR;
property-get UfSystemDb: IDispatch;
property-get ShareString: BSTR;
property-get LogState: I4;
property-get SysPassword: BSTR;
property-get CSubName: BSTR;
property-get cAcc_Id: BSTR;
property-put cAcc_Id(^BSTR);
property-get CAccName: BSTR;
property-get CurDate: date;
property-get cIYear: BSTR;
property-get iMonth: I2;
property-get cUserId: BSTR;
property-get cUserName: BSTR;
property-get UfDbName: BSTR;
property-get UfDbPath: BSTR;
property-get UfZtPath: BSTR;
property-get IsAdmin: bool;
property-get InitVar: BSTR;
function ClearError;
function AccPeriod(out bRetPeriod:^bool
out dateBegin:^date
out dateEnd:^date): I4;
function Login(out pSubId:^BSTR
out pAccId:^BSTR
out pYearId:^BSTR
out pUserId:^BSTR
out pPassword:^BSTR
out pDate:^BSTR
out cSrv:^BSTR): bool;
function LoginAS(pSubId:BSTR): bool;
function TaskExec(pAuth_id:BSTR
bIsLock:I2
iYear:I2): bool;
function ClosingStatus(nIndex:I2
cSubId:BSTR
iYear:I2
out bStateValue:^bool): bool;
function GetAccInfo(nIndex:I4
out vValue:^variant): bool;
function ShutDown;
function FD_Month_Used(out dbszj:^^_Connection): I2;
function CADemoMonth(out dbs:^^_Connection): I2;
function IAMonthHandled(out ObjDatabase:^^_Connection): I2;

Class Login;
GUID={A11BCAA6-730E-11D4-BD7C-000021EA4FD8};
function QueryInterface(riid:^GUID
out ppvObj:^^void);
function AddRef: UI4;
function Release: UI4;
function GetTypeInfoCount(out pctinfo:^UINT);
function GetTypeInfo(itinfo:UINT
lcid:UI4
out pptinfo:^^void);
function GetIDsOfNames(riid:^GUID
rgszNames:^^I1
cNames:UINT
lcid:UI4
out rgdispid:^I4);
function Invoke(dispidMember:I4
riid:^GUID
lcid:UI4
wFlags:UI2
pdispparams:^DISPPARAMS
out pvarResult:^variant
out pexcepinfo:^EXCEPINFO
out puArgErr:^UINT);
property-get cServer: variant;
property-put cServer(variant);
property-put ProcessId(^I4);
function RemoteExec(out cCmd:^BSTR): variant;
property-get LanguageID: I4;
property-get cUserPassWord: BSTR;
property-get UfSystemDb: IDispatch;
property-get ShareString: BSTR;
property-get LogState: I4;
property-get SysPassword: BSTR;
property-get CSubName: BSTR;
property-get cAcc_Id: BSTR;
property-put cAcc_Id(^BSTR);
property-get CAccName: BSTR;
property-get CurDate: date;
property-get cIYear: BSTR;
property-get iMonth: I2;
property-get cUserId: BSTR;
property-get cUserName: BSTR;
property-get UfDbName: BSTR;
property-get UfDbPath: BSTR;
property-get UfZtPath: BSTR;
property-get IsAdmin: bool;
property-get InitVar: BSTR;
function ClearError;
function AccPeriod(out bRetPeriod:^bool
out dateBegin:^date
out dateEnd:^date): I4;
function Login(out pSubId:^BSTR
out pAccId:^BSTR
out pYearId:^BSTR
out pUserId:^BSTR
out pPassword:^BSTR
out pDate:^BSTR
out cSrv:^BSTR): bool;
function LoginAS(pSubId:BSTR): bool;
function TaskExec(pAuth_id:BSTR
bIsLock:I2
iYear:I2): bool;
function ClosingStatus(nIndex:I2
cSubId:BSTR
iYear:I2
out bStateValue:^bool): bool;
function GetAccInfo(nIndex:I4
out vValue:^variant): bool;
function ShutDown;
function FD_Month_Used(out dbszj:^^_Connection): I2;
function CADemoMonth(out dbs:^^_Connection): I2;
function IAMonthHandled(out ObjDatabase:^^_Connection): I2;

Alias Login___v0;
GUID={A11BCAA5-730E-11D4-BD7C-000021EA4FD8};
_Login

Alias Login___v1;
GUID={0611E295-73F5-11D4-BD7E-000021EA4FD8};
_Login

Alias Login___v2;
GUID={AEF554F9-759C-11D4-BD83-000021EA4FD8};
_Login

Alias Login___v3;
GUID={DC372A5F-772B-11D4-BD85-000021EA4FD8};
_Login

我该如何在 delphi 中传递一个 loginas('DP')过去,得到
Login的pSubId;pAccId;pYearId;pUserId;pDate;cSrv;?

 
试一下这样
function Login(pSubId:Pchar
pAccId:Pchar
pYearId:Pchar;pUserId:Pchar
pPassword:Pchar
pDate:Pchar
cSrv:Pchar): boolean;stdcall
external 'login.dll';
function LoginAS(pSubId:string): boolean;;stdcall
external 'login.dll';


调用时
if loginAs(subid) then
login(subid,paccid,.....);
 
新建工程,加入button1 将您的代码复过去
procedure Button1Click(Sender: TObject);
function Login(pSubId:Pchar
pAccId:Pchar
pYearId:Pchar;pUserId:Pchar
pPassword:Pchar
pDate:Pchar
cSrv:Pchar): boolean;stdcall
external 'login.dll';
function LoginAS(pSubId:string): boolean;stdcall
external 'login.dll';
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var cuserid:string;
begin
if loginas('Dp') then ...
end;

编译出错!:Field definition not allowed after methods or properties;
 
....
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

function Login(pSubId:Pchar
pAccId:Pchar
pYearId:Pchar;pUserId:Pchar
pPassword:Pchar
pDate:Pchar
cSrv:Pchar): boolean;stdcall
external 'login.dll';
function LoginAS(pSubId:string): boolean;stdcall
external 'login.dll';

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var cuserid:string;
begin
if loginas('Dp') then ...
end;
 
对,你定义的位置错了,看OpuBF的贴子。
 
执行:
无法找到入口:
 无法定位程序输入点 loginas 于动态链接库 ../login.dll 上。
 
各位师兄,帮帮忙!分不够可以加。
 原因是这样的,我在用友sql813下做了几个小的外挂程序,以前login界面是自已做的,
(注册日期,用户名,用户密码等直接从数据库里抓)现在用友升的U8,用户密码加了密
我的LOGIN就没法验证用户密码了,所以想调用用友的LOGIN返回注册日期、登录帐套等信息
可我对DLL不熟悉,哪位师兄告诉我,我该怎么做才能达到目的。
 
我自己试做了一个DLL,在98下面用快速查看有EXPORT项,并可以引用,但用友的LOGIN没有
EXPORT项。我该如何在 delphi 中传递一个 loginas('DP')过去,得到
Login的pSubId;pAccId;pYearId;pUserId;pDate;cSrv;?
 
我今天遇到一个与 C 有关的问题,即调用 C 的 Dll 库。其中两个函数为:
int GetBuyData(unsigned char *data);

int GetinvoiceNum(DWord * Num)

它们的数据类型 Unsigned char * 和 DWord * 如何转换为 Delphi 的类型,又如何
进行赋值和将值转换为 String 型。

特此感谢!!!

wjk
wenjk@couragetech.com.cn
 
try
PDWord = ^DWord
//if not define,define it
function GetBufData(data: PArrayByte):integer;stdcall;...
function GetinvoiceNum(Num: PDWord):integer;stdcall;...

var
d: TArrayByte;
ptrd := @d

...
copymemory(ptrd,sourcedata,sourcecout);

GetBufData(ptrd);
 
这些天看了李维的ADO/MTS/COM, D5开发人员指南.对COM调用仍是云里雾里.看来
我的问题该是COM的问题.有GUID,有FUNCTION原型,就没人会吗?

高手们都不屑赐教?!



顺便提一下.
 
高手哪去了?
再提!
 
自已搞定。
 
请问xf163是如何搞定的?谢谢,我也遇到了同样的问题。
 
to cooldeer:
对 Com 控件:(当然你需要知道其GUID或SERVERNAME并知道其内部方法 )
法一: 用DCOMConnection GUID 设为Login的GUID
DcomConnection.Conneted:=True;
用Dcomconnection.appserver....访问其定义的方法。
法二:
var
Uflogin: OleVariant;
accstring:string;
begin
uflogin := CreateOleObject('ufloginsql.login');
if not varisempty(uflogin) then
if ufLogin.login('dp') then
begin
。。。。。
messageBox(handle,pchar(成功了!),'Ok:',mb_ok);
end;

希望能对大家有所帮助。



 
后退
顶部