dll原形如下:funtion foo(ihdc:THandle) stdcall;export;
var
// 以下略
begin
bitmap1:=Tbitmap.create;
bitmap1.canvas.handel=ihdc;
// 处理该位图
end在delphi中调用
foo(Image1.canvas.handel);
可以正确传递该句柄给DLL中的bitmap1.canvas.handle及结果正确
但在VB中
声明
Private Declare Function foo Lib "test.dll" (ByVal ihdc As Long)
调用
foo(picturebox1.picture.handle)
但此句柄送到DLL中的bitmap1.canvas.handle却得不到正确的结果。
以上的dll,delphi,vb程序均可编译和运行,唯在vb中调用DLL则结果错误。
各位高手
picturebox.handle该怎样才能正确传动bitmap1.canvas.handel
var
// 以下略
begin
bitmap1:=Tbitmap.create;
bitmap1.canvas.handel=ihdc;
// 处理该位图
end在delphi中调用
foo(Image1.canvas.handel);
可以正确传递该句柄给DLL中的bitmap1.canvas.handle及结果正确
但在VB中
声明
Private Declare Function foo Lib "test.dll" (ByVal ihdc As Long)
调用
foo(picturebox1.picture.handle)
但此句柄送到DLL中的bitmap1.canvas.handle却得不到正确的结果。
以上的dll,delphi,vb程序均可编译和运行,唯在vb中调用DLL则结果错误。
各位高手
picturebox.handle该怎样才能正确传动bitmap1.canvas.handel
var
// 以下略
begin
bitmap1:=Tbitmap.create;
bitmap1.handel=ihdc;//change this like;
// 处理该位图
end
foo(image1.Picture.Bitmap.Handle ;);
听别人说,VB中写的DLL是伪DLL,我也不是太清楚,只能帮你UP了。再次讨厌VB~~~~~
该改为
foo(picturebox1.hdc)