title: WIA 2 on Windows 7 -- Delphi
body: <p>WIA 2 on Windows 7 doesn't detect my camera while WIA 1 on Windows XP detects it.</p>
  
  <p>I try to run my program as admin.</p>
  
  <p>My camera is :</p>
  
  <p>Asus usb2 webcam.</p>
  
  <p>Delphi return the message:</p>
  
  <blockquote>
    <p>(like this) not available any wia devices from specified type </p>
  </blockquote>
  
  <p>or</p>
  
  <blockquote>
    <p>Access Violation at address ...... in module ......</p>
  </blockquote>
  
  <p>I use this code:</p>
  
  <pre><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;
  </code></pre>