DLL 的头文件如下:
#ifdef __cplusplus
#define EXPORT extern "C" __declspec(dllexport) VRT_FA
#else
#define EXPORT __declspec(dllexport) VRT_FA
#endif
#define int VRT_FAEXPORT FA_BeforeEncode(
HWND hWndParent, //Input
LPCTSTR pszFiles[], //Input
int cbOutFileSize, //Input
LPTSTR pszOutFiles[] //Output
)封装DLL后,在VC调用没问题,但在DEPHI 调用时参数 cbOutFileSize没法传进,其它三个没问题。在VC调试DLL时,发现cbOutFileSize为 2 。
在DEPHI 的调用代码如下:type TFA_BeforeEncode = function(
hWndParent: hwnd; //Input
pszFiles: array of string; //Input
cbOutFileSize: integer; //Input
pszOutFiles: array of string //Output
):integer; cdecl;
procedure TForm1.Button1Click(Sender: TObject);
var
hLib: HMODULE;
FA_BeforeEncode:TFA_BeforeEncode;
hWndParent: hwnd;
pszFiles: array of string ;
pszOutFiles: array of string;
cbOutFileSize:integer;
BEGIN hLib := LoadLibrary('FA_API.dll');
Setlength(pszFiles,3);
Setlength(pszOutFiles,3);
cbOutFileSize:=256;
pszFiles[0]:='c:\test1.txt';
pszFiles[1]:='c:\test2.txt';
pszFiles[2]:='';
hWndParent:=form1.Handle;
try
FA_BeforeEncode := GetProcAddress(hLib,'FA_BeforeEncode');
if (@FA_BeforeEncode <> nil) then
FA_BeforeEncode(hWndParent,pszFiles,cbOutFileSize,pszOutFiles);
finally
FreeLibrary(hLib);//
end;END.
#ifdef __cplusplus
#define EXPORT extern "C" __declspec(dllexport) VRT_FA
#else
#define EXPORT __declspec(dllexport) VRT_FA
#endif
#define int VRT_FAEXPORT FA_BeforeEncode(
HWND hWndParent, //Input
LPCTSTR pszFiles[], //Input
int cbOutFileSize, //Input
LPTSTR pszOutFiles[] //Output
)封装DLL后,在VC调用没问题,但在DEPHI 调用时参数 cbOutFileSize没法传进,其它三个没问题。在VC调试DLL时,发现cbOutFileSize为 2 。
在DEPHI 的调用代码如下:type TFA_BeforeEncode = function(
hWndParent: hwnd; //Input
pszFiles: array of string; //Input
cbOutFileSize: integer; //Input
pszOutFiles: array of string //Output
):integer; cdecl;
procedure TForm1.Button1Click(Sender: TObject);
var
hLib: HMODULE;
FA_BeforeEncode:TFA_BeforeEncode;
hWndParent: hwnd;
pszFiles: array of string ;
pszOutFiles: array of string;
cbOutFileSize:integer;
BEGIN hLib := LoadLibrary('FA_API.dll');
Setlength(pszFiles,3);
Setlength(pszOutFiles,3);
cbOutFileSize:=256;
pszFiles[0]:='c:\test1.txt';
pszFiles[1]:='c:\test2.txt';
pszFiles[2]:='';
hWndParent:=form1.Handle;
try
FA_BeforeEncode := GetProcAddress(hLib,'FA_BeforeEncode');
if (@FA_BeforeEncode <> nil) then
FA_BeforeEncode(hWndParent,pszFiles,cbOutFileSize,pszOutFiles);
finally
FreeLibrary(hLib);//
end;END.
解决方案 »
- 二维Otsu阈值分割法,发生内存不能“read”,求解答!
- 求一个MSN sniffer 源代码
- 用bcg做一个类似vc开发中的workspace中的classview,resource,file的属性页,但想分为两排实现,大家帮忙看一看。
- 为何我的钩子不能钩住其他进程
- MDI界面全屏问题,请教:
- 菜单问题!!!
- 大家帮帮刚接触vc++的我,在vc6.0下用什么报表控件方便,
- 请教各位大侠:在屏幕上显示时动画(flash 制作),如何把动画的背景色去掉呢?
- 拦截并修改打印内容
- 请教OpenH323能支持多少个人同时使用?
- 怎么能在窗口内任意位置显示一个BMP图象?(单文档模式)
- class A<class B>是什么东西?
type TFA_BeforeEncode = function(
hWndParent: hwnd; //Input
pszFiles: array of string; //Input
cbOutFileSize: integer; //Input
pszOutFiles: array of string //Output
):integer; stdcall;