在delphi 中写了个dll,在pb9.0中调用要出错,请大家帮我看看是什么原因?

飞扬残月 2008-02-27 03:13:59
delphi中代码:
library Project1;

uses
SysUtils,
Classes,
ExtCtrls,
Jpeg,
Graphics;

{$R *.res}
procedure setpic(AOwner:TComponent;fromfile:pchar);stdcall;
var
Jpeg:TjpegImage;
tmpBmp:TBitmap;
image1:TImage;
image2:TImage;
begin
image1:= TImage.Create(AOwner);
image2:= TImage.Create(AOwner);
jpeg:=TjpegImage.Create();
tmpBmp:=TBitmap.Create;
try
image1.picture.LoadFromFile(fromfile);
Image2.Height:= 425;//新图像高度
Image2.Width := 512;//新图像宽度
Image2.Canvas.StretchDraw(Image2.ClientRect,Image1.Picture.Graphic);
image2.picture.savetofile(fromfile);
tmpbmp.loadfromfile(fromfile);
jpeg.Assign(tmpbmp);
jpeg.SaveToFile(fromfile);
finally;
Image1.Free;
Image2.Free;
jpeg.Free;
tmpbmp.Free;
end;
end;

exports
setpic;
begin
end.
pb中申明:SUBROUTINE SetPic(string fromfile) Library "project1.dll" Alias
For "setpic;ansi"//申明function也不行
pb中调用,setpic(ls_pathname)
pb中报错
怎么解决这个问题啊
...全文
145 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
feixianzhi 2008-03-13
  • 打赏
  • 举报
回复
注意引用时的大小写、参数的传递方式、参数类型!
xiaoHitler 2008-03-09
  • 打赏
  • 举报
回复
PB申明中注意大小写试试,setpic
moonlighter 2008-03-01
  • 打赏
  • 举报
回复
你的Dephi的setpic(AOwner:TComponent;fromfile:pchar);是两个参数啊,PB中怎么申明成一个参数了?
moonlighter 2008-03-01
  • 打赏
  • 举报
回复
问题是第一个参数怎么传?它是Dephi的一个在,在PB中这个参数怎么定义?而且它一定是引用型,应加ref的。
Dephi已有两年多没使用了,全忘了。
飞扬残月 2008-03-01
  • 打赏
  • 举报
回复
申明成两个也不行
SKY_4K_PPM 2008-03-01
  • 打赏
  • 举报
回复
没玩过DELPHI ,如果是楼上所说,楼主真该...........

1,108

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧