WIA 2 on Windows 7 doesn't detect my camera while WIA 1 on Windows XP detects it.
I try to run my program as admin.
My camera is :
Asus usb2 webcam.
Delphi return the message:
(like this) not available any wia devices from specified type
or
Access Violation at address ...... in module ......
I use this code:
procedure TForm1.Button9Click(Sender: TObject);
Const
wiaFormatBMP ='{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}';
var
CommonDlg: ICommonDialog;
AImage: IImageFile;
ImagePath: String;
DeviceManager1 :iDeviceManager;
begin
CommonDlg := createOleObject('WIA.CommonDialog') as ICommonDialog;
DeviceManager1 := createOleObject('WIA.DeviceManager') as iDeviceManager;
edit1.Text:= inttostr( DeviceManager1.DeviceInfos.Count);
AImage := CommonDlg.ShowAcquireImage(UnspecifiedDeviceType,UnspecifiedIntent,
MaximizeQuality,wiaFormatBMP,true,False,True);
ImagePath := 'C:\temp\test.bmp';
AImage.SaveFile(ImagePath);
end;
I recently had a similar experience with WIA and Win7.
What I eventually ended up using was a DirectX solution.
Delphi Basics - DirectX webcam capture
I don't remember how I originally found this project, but under Win7 it just works even with older webcams that I found lying around the office.
I recommend you look at Demo3 in the download file as that had the best, simple, example of what I needed. YMMV.
(Edit) My WIA problem extended from the fact that the webcam maker did not support WIA or Twain under Win7.