当前位置:主页>delphi盒子/delphi园地/编程技巧> 文章内容

发布时间:2010-01-20 | QQ免费站
1楼: 在vc中生成dll 在delphi中如何调用vc中声明如下的函数:主要是参数转换问题!谢谢!!! // 图像镜像导出函数 int _stdcall MirrorBmp(HDC hdcSrc,HBITMAP hbmpSrc,HDC hdcDest,BOOL bDirection) //图像细化函数 BOOL WINAPI ThiningDIB(LPSTR lpDIBBits, LONG lWidth, LONG lHeight)
字串7

2楼: function MirrorBmp(hdcSrc,hbmpSrc:THandle;bDirection:Integer):Integer;stdcall; function ThiningDIB(lpDIBBits:PChar;lWidth,lHight:Integer):Integer;stdcall; 字串3

3楼: function MirrorBmp(hdcSrc: HDC; hbmpSrc: THandle; hdcDest: HDC; bDirection: BOOLean): boolean; stdcall; function MirrorBmp; external ‘GeoTrans.dll‘ name ‘MirrorBmp‘; var SrcDC, DestDC: HDC; begin SrcDC := Image1.Picture.Bitmap.Handle; DestDC := Image2.Picture.Bitmap.Handle; if MirrorBmp(SrcDC, Image1.Picture.Bitmap.Handle, DestDC, false) then ShowMessage(‘True‘) else ShowMessage(‘false‘); end; 结果显示true;但没输出任何东西!!!
字串7

4楼: SrcDC := Image1.Picture.Bitmap.canvas.Handle; DestDC := Image2.Picture.Bitmap.canvas.Handle;

字串6

5楼: to flamboyant 我试过了,还是不行!!! 字串7

6楼: int _stdcall MirrorBmp(HDC hdcSrc,HBITMAP hbmpSrc,HDC hdcDest,BOOL bDirection) 改成 int _stdcall MirrorBmp(HDC *hdcSrc,HBITMAP *hbmpSrc,HDC *hdcDest,BOOL bDirection)看看 字串3

7楼: function MirrorBmp(hdcSrc: HDC; hbmpSrc: THandle; hdcDest: HDC; bDirection: BOOLean): boolean; stdcall; 函数返回值不是整型么?怎么变boolean了?
字串9

8楼: function ThiningDIB(lpDIBBits:PChar;lWidth,lHight:Integer):Integer;stdcall; lpDIBBits:PChar可能这样定义有问题,你最好传一个lpDIBBits: array[0..31] of char给它最好 还有HBITMAP和HDC是两个不同的概念,你最好这样写 SrcDC := Image1.canvas.Handle; DestDC := Image2.canvas.Handle; 如果你更保险一点的话,在p1和p2中加入图片,哈哈 字串1

9楼: to gongyuzhuo 还是不行,出错!!! 大家留个email,我把vc的源代码和dll说明传过来大家看看!!怎么在delphi中调用。 要是成功的化,就可意在delphi中调用任何vc中比较好的算法了!!!
字串6

10楼: tseug@263.net

字串7

11楼: 我看了一下,是调用你自定义的DIBfromBitmap失败,因为没有VC,我在Delphi中跟踪 的结果是调用GetDIBits时参数错误,错误码是$57,参数错误,如果你能用VC写个调用 DLL的例子,估计能知道错误的原因

字串2

12楼: 谢谢!!!
字串3