olympus sdk and delphi ( 积分: 200 )

  • 主题发起人 主题发起人 fux
  • 开始时间 开始时间
F

fux

Unregistered / Unconfirmed
GUEST, unregistred user!
Has anyone used the olympus sdk to download a picture with delphi.
I got some sample code, but it does not work. I think it is something
to do with the olevariant. Can anyone help?
var
OleBuffer: OleVariant;
PicNum: Integer;
PicSize: Integer;
begin
Jam1.Connect;
PicNum := Jam1.propPicCount;
Label2.Caption := IntToStr(PicNum);
Jam1.propCurrentPicture := PicNum;
PicSize := Jam1.propPicSize;
Label4.Caption := IntToStr(PicSize);
Application.ProcessMessages;
OleBuffer := VarArrayCreate([1,PicSize],varByte);
Jam1.GetPicture(PicSize,OleBuffer);
VariantToFile('c:/project1.jpg',OleBuffer);
Application.ProcessMessages;
Jam1.DisConnect;
Close;


procedure TForm1.VariantToFile(FileName: String; var AVariant:
OleVariant);
var
AStream: TFileStream;
MyBuffer: PUCHAR;
Size: Integer;
begin
AStream:=TFileStream.create(FileName,fmCreate);
try
aStream.Position := 0;// Seek(0, soFromBeginning);
Size:=VarArrayHighBound(AVariant,1);//+VarArrayLowBound(AVariant,1);
MyBuffer:=VarArrayLock(AVariant);
AStream.WriteBuffer(MyBuffer^,Size);
Application.ProcessMessages;
VarArrayUnlock(AVariant);
finally
AStream.Free;
end;
end;
 
Has anyone used the olympus sdk to download a picture with delphi.
I got some sample code, but it does not work. I think it is something
to do with the olevariant. Can anyone help?
var
OleBuffer: OleVariant;
PicNum: Integer;
PicSize: Integer;
begin
Jam1.Connect;
PicNum := Jam1.propPicCount;
Label2.Caption := IntToStr(PicNum);
Jam1.propCurrentPicture := PicNum;
PicSize := Jam1.propPicSize;
Label4.Caption := IntToStr(PicSize);
Application.ProcessMessages;
OleBuffer := VarArrayCreate([1,PicSize],varByte);
Jam1.GetPicture(PicSize,OleBuffer);
VariantToFile('c:/project1.jpg',OleBuffer);
Application.ProcessMessages;
Jam1.DisConnect;
Close;


procedure TForm1.VariantToFile(FileName: String; var AVariant:
OleVariant);
var
AStream: TFileStream;
MyBuffer: PUCHAR;
Size: Integer;
begin
AStream:=TFileStream.create(FileName,fmCreate);
try
aStream.Position := 0;// Seek(0, soFromBeginning);
Size:=VarArrayHighBound(AVariant,1);//+VarArrayLowBound(AVariant,1);
MyBuffer:=VarArrayLock(AVariant);
AStream.WriteBuffer(MyBuffer^,Size);
Application.ProcessMessages;
VarArrayUnlock(AVariant);
finally
AStream.Free;
end;
end;
 
做过,给我SDK,调试一个例子给你.Tiger700131@126.com
 
TigerDing大哥啊,给你发了邮件了,不知道有没收到了,快给我一个回音,急死 了
 
后退
顶部