2009-02-04 47 views

回答

1

Windows图像采集确实与wiaCommandTakePicture的伎俩(VB.NET按你的标签:))

为证明这一project by Hanselman in coding4fun

我粘贴,C#代码,但你可以阅读该网站还对VB.NET备选方案:

CommonDialogClass class1 = new CommonDialogClass(); 
Device d = class1.ShowSelectDevice(WiaDeviceType.UnspecifiedDeviceType, true,false); 
if (d != null) 
{ 
    settings.DeviceID = d.DeviceID; 
    settings.Save(); 
} 


Item item = device.ExecuteCommand(CommandID.wiaCommandTakePicture); 
foreach (string format in item.Formats) 
{ 
    if (format == jpegGuid) 
    { 
     WIA.ImageFile imagefile = item.Transfer(format) as WIA.ImageFile; 
     filename = GetFreeFileName(); 
     if (string.IsNullOrEmpty(filename) == false) 
     { 
      imagefile.SaveFile(filename); 
     } 
     this.picLastImage.Load(filename); 
     return filename; 
    } 
} 
+0

+1,好工具(加我要找到一个很好的职位从您给予好评;)13倒,二去:HTTP://计算器。 com/questions/359727#486543) – VonC 2009-02-18 07:14:17

1

DirectShow很不错。看看这个问题here