I want to pull off all the inmages from a JPEG phone. Our workers complete their task, connect their phones to the laptop and I am to pull all the images from the phone to send in. We had a VB6 app doing this but it was for XP and WIA 1. I am trying to re-write it in Delphi. I imported Windows Image Aquisition. The code I am using to test is: unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.OleAuto, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, WIA_TLB;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses ActiveX,shlobj,JPEG, ShellAPI;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
Const
wiaFormatBMP ='{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}';
wiaFormatJPEG = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}';
// wiaFormatJPEG = '{B96B3CA9-0728-11D3-9D7B-0000F81EF32E}';
wiaFormatGIF = '{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}';
var
CommonDlg: ICommonDialog;
AImage: IImageFile;
ImagePath: String;
DeviceManager1 :IDeviceManager;
begin
CommonDlg := CoCommonDialog.Create;
AImage := CoImageFile.Create;
DeviceManager1 := CoDeviceManager.Create;
edit1.Text:= inttostr( DeviceManager1.DeviceInfos.Count);
AImage := CommonDlg.ShowAcquireImage(UnspecifiedDeviceType,UnspecifiedIntent,
MaximizeQuality, wiaFormatJPEG, false,False,True);
ImagePath := 'C:\temp\test.jpg';
AImage.SaveFile(ImagePath);
end;
end. (also wtf is wrong with this editor? I cannot use carrage returns) I am able to connect to my phone but when I try to aquire an image, I am symply told (after about a 20 sec delay) that a parameter is incorrect? I really need to get this done! I have tried various formats i.e. gif, jpeg, bmp and assured that they are all on my phone. I have set Device type to both camera and unspecified. No matter what, I get the same result. thanks in advance. _SR (test phone is Galaxy S4) Android 4.4.2 I get a EoleException "THe parameter is incorrect" Yet it does work with my tablet (Galaxy Tab Pro 8.4) same Android Delphi XE6
Connect with Us