我用DELPHI5写了一个将.BMP文件转换成.JPG文件的DLL,在DELPHI5环境中可以调用该DLL可是在VB6中调用总是出错,请各位高手支招!!!
DELPHI源代码:
library BMPTOJPG;
uses
SysUtils,
Classes,
Graphics,
jpeg;
{$R *.RES}
function bmptojpgF(filestring:widestring):byte;export;
var
jp:Tjpegimage;
abmp:Tbitmap;
f:file;
begin
try
jp:=tjpegimage.create;
abmp:=tbitmap.create;
abmp.LoadFromFile(filestring+'.bmp');
jp.assign(abmp);
abmp.free;
jp.SaveToFile(filestring+'.jpg');
jp.free;
assignfile(f, filestring+'.bmp');
erase(f);
result:=1;
except
result:=0
end;
end;
exports
bmptojpgF;
begin
end.
VB6源代码:
Public Declare Function bmptojpgF Lib "bmptojpg.dll" (ByVal filestring As String) As Byte
Private Sub Command1_Click()
Dim i
i = bmptojpgF("d:\tuxiang\10209011132021")
End Sub
use vb write the path where the .bmp file locate then
use delphi dll to read the path string and change the
bmp image files to jpeg files format it's ok then!
i have done it and i am success with it.
i have found there r some thouble of the transport
of string between vb and delphi either the delphi7 that
have not resolve this problem
i feel it is a little pitty with their com component
function bmptojpgF(filestring:PChar):byte;export;
只是感觉