Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: WIA 2.0 with android phone


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Nov 13, 2015 8:29 AM Last Post By: Borja Serrano
LAURENCE KILLEN

Posts: 41
Registered: 2/20/00
WIA 2.0 with android phone  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 28, 2014 1:39 PM
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

LAURENCE KILLEN

Posts: 41
Registered: 2/20/00
Re: WIA 2.0 with android phone  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 13, 2015 6:36 AM   in response to: LAURENCE KILLEN in response to: LAURENCE KILLEN
I figured it out.
Borja Serrano

Posts: 53
Registered: 1/10/13
Re: WIA 2.0 with android phone  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 13, 2015 8:29 AM   in response to: LAURENCE KILLEN in response to: LAURENCE KILLEN
Springer Rider wrote:
I figured it out.

What was the problem?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02