VC中写的 Actpicture.dll 在delphi中调用。在VC中接口名为ILocatePtr
接口函数为 BOOL SetPicture(BYTE *pBuf)
(pBuf我理解是指向byte的指针,不知道对否?)
--------------------------
在delphi中采用静态调用方式如下function SetPicture(var pBuf: pByte):Integer;stdcall;external 'Actpicture.dll';
...
var
pBitmapHeader: pBitmapInfo;
pBitmapImage : pByte;
HeaderSize : DWORD;
ImageSize : DWORD;
begin
GetDIBSizes(AmmeterBmp.Handle, HeaderSize, ImageSize);
GetMem(pBitmapImage, ImageSize);
try
if Boolean(SetPicture(pBitmapImage)) then
begin
showmessage('加载成功!')
end
else begin
showmessage('加载失败!');
end;
finally
FreeMem(pBitmapImage);
end; *****************************************
试了好几种方式均不行,包括声明为pointer等
结果要么是SetPicture(pBitmapImage)不对。
要么是提示“无法定位程序输入点SetPicture于动态链接库Actpicture.dll 上”!是否和接口函数有关呢?
请高手帮忙指点!!!
接口函数为 BOOL SetPicture(BYTE *pBuf)
(pBuf我理解是指向byte的指针,不知道对否?)
--------------------------
在delphi中采用静态调用方式如下function SetPicture(var pBuf: pByte):Integer;stdcall;external 'Actpicture.dll';
...
var
pBitmapHeader: pBitmapInfo;
pBitmapImage : pByte;
HeaderSize : DWORD;
ImageSize : DWORD;
begin
GetDIBSizes(AmmeterBmp.Handle, HeaderSize, ImageSize);
GetMem(pBitmapImage, ImageSize);
try
if Boolean(SetPicture(pBitmapImage)) then
begin
showmessage('加载成功!')
end
else begin
showmessage('加载失败!');
end;
finally
FreeMem(pBitmapImage);
end; *****************************************
试了好几种方式均不行,包括声明为pointer等
结果要么是SetPicture(pBitmapImage)不对。
要么是提示“无法定位程序输入点SetPicture于动态链接库Actpicture.dll 上”!是否和接口函数有关呢?
请高手帮忙指点!!!
EXPORTS
SetPicture @1
有没有把Actpicture.dll 拷贝到当前目录(project)里面啊我的调用方法
function get_status(icdev: longint; status:pchar)
:smallint;stdcall;far;external 'MWIC_32.dll' name 'get_status';
你的dll的def文件(VC),有无如下声明
EXPORTS
SetPicture @1
若无,即使你在h文件和cpp文件中定义为入口函数,delphi还是会找不到的
入口函数定义格式int FAR PASCAL EXPORT SetPicture(BYTE *pBuf);
用loadlibrary函数动态调用吧
...
Pfunc := GetProcAddress(Moudle,'SetPicture');结果返回 Pfunc总是nil,不知道是什么问题。
function bmqSetip(IP : pchar) : Integer;stdcall;external 'bmqClient.dll';
1、要么你在DLL中没有Export这个函数。
2、要么你的DLL中没有定义它为stdcall方式。因为stdcall接口除了规定参数压栈顺序外,还修改了函数名。此外,还有一点,在DELPHI中的函数原型定义有一点点小问题(与VC中的函数定义不一致),不过这不是产生“无法定位....”那个错误的原因:VC中接口函数为
BOOL stdcall SetPicture(BYTE *pBuf)
delphi中定义为:
function SetPicture(pBuf: PByte): Longbool; stdcall; external 'Actpicture.dll';
GetProcAddress(
HMODULE hModule, // handle to DLL module
LPCSTR lpProcName // name of function
);
的第二个参数如果(不知道函数名的情况下用序号)方式调用,资料上都说可以,但没给出具体的写法。