WIA 2 on Windows 7 - Delphi

WIA 2 on Windows 7 does not detect my camera, while WIA 1 on Windows XP detects it.

I am trying to run my program as admin.

My camera:

Webcam Asus usb2.

Delphi returns a message:

(like this) no wia devices of the specified type are available

or

Access violation at address ...... in module ......

I am using 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; 
+4
source share
1 answer

I recently had a similar experience with WIA and Win7.

In the end, I decided to use DirectX.

Delphi Basics - DirectX Webcam Capture

I donโ€™t remember how I initially found this project, but under Win7 it just works even with the old webcams that I found in the office.

I recommend that you look at Demo3 in the download file, as it had the best, simplest example of what I needed. YMMV.

(Edit) My problem with WIA was expanded due to the fact that the webcam manufacturer did not support WIA or Twain under Win7.

0
source

Source: https://habr.com/ru/post/1410992/


All Articles