您的位置:首页 > 其它

中间件相关

2016-03-30 09:04 519 查看
//获取中间件包含的功能号
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TFunctionEntry = function(const RunDbName, HisDbName: PChar; const Request: Pointer; ReqLen: Integer;
var Answer: Pointer; var Size, Length: Integer): Integer;stdcall;

TFunctionQueryInterface=function (Index: Integer; var FunctionNo, Version: SmallInt;
Caption: PChar; var Entry: TFunctionEntry): BOOL;stdcall;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
handle:THandle;
sdll:string;
QueryInterface:TFunctionQueryInterface;
Index: Integer;
FunctionNo, Version: SmallInt;
Caption: PChar;
Entry: TFunctionEntry;
begin
sdll:='D:\Hsassetmanage30\Bin\hscom\platform\com\s_File.dll';
Index:=0;
FunctionNo:=1;
Version:=1;
Caption:=PChar(StringOfChar(#0, 33)); //按深拷贝理解 需要分配空间
Entry:=nil;
handle:=LoadLibrary(PAnsiChar(sdll));
if handle<>0 then
begin
@QueryInterface:=GetProcAddress(handle, 'QueryInterface');
if @QueryInterface<>nil then
begin
if QueryInterface(Index,FunctionNo,Version,Caption,Entry) then
ShowMessage(IntTostr(FunctionNo)+'  '+Caption);
end
else
begin
ShowMessage('无对应函数');
end;
FreeLibrary(handle);
end;
end;
end.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: