Click here to Skip to main content
16,021,823 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dears,

I have a USB Camera connected to my pc.
I want to take pictures and save them.

I tried the following code but i got this error "HRESULT: OX80210015"
on this line
(Device d = class1.ShowSelectDevice(WiaDeviceType.CameraDeviceType,true,false))



using WIA;

string wiaFormatGIF = "{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}";

WIA.CommonDialogClass class1 = new WIA.CommonDialogClass();
Device d = class1.ShowSelectDevice(WiaDeviceType.CameraDeviceType,true,false);
if (d != null)
{
DeviceID = d.DeviceID;
}
else
{
return;
}

WIA.CommonDialog WiaCommonDialog = new CommonDialogClass();

WIA.Item item = d.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture);
ImageFile img = (ImageFile)item.Transfer(wiaFormatGIF);

img.SaveFile("C:\\MyImage.gif");


Any ideas how can i solve this problem?
Thanks in advance.
Posted
Comments
Bernhard Hiller 23-May-13 2:41am    
Why did you tag this question "ASP.Net"? Do you want to runthat coce from the WEB SERVER? That won't work.
Sandra Ha 23-May-13 7:39am    
No not webserver , i will run this code from a class library as a method called from a windows application

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900