1.11M Members

WIA Automation SDK and Multithreading


Hi to all, I'm using the WIA Aut. Library http://www.microsoft.com/downloads/details.aspx?familyid=a332a77a-01b8-4de6-91c2-b7ea32537e29&displaylang=en , trying to capture photos from 5 digital cameras (Nikon D90) USB-connected to my pc. Now, I partially achieved my goal, what I do is:
- loop through the attached devices, connecting to every camera;
- fotocamera.ExecuteCommand (WIA.CommandID.wiaCommandTakePicture) ;
- other image processing operations...
Everything works fine but... the workflow is camera1 -> connect -> grab pic. => camera 2 -> connect -> grab pic. => camera 3.....

What I'd like is to make them shoot all at the same moment (...why? well, D90 waits around 1 sec. after a shoot... 1sec * 12 cameras * 500 photo sessions.. :'( )
I told myself... what's the problem? You can create "shooting-threads" while looping through the device then launch 'em all.
It's still in a 'serial' way... :-(((
Why? is executeCommand() a synchronized method?
If I madly-fast click on two 'grab pictures' button of windows XP WIA dialog it works.. Is there something about .NET multithreading I don't know?

Please help me if you can!!


Oh I forgot about it...
If I create a little command-line exe which only takes photo, and make threads call it... all works.
why putting the photo command inside the thread cause synchronization?


Hi Fabio,

could you please give me sample code to get image from digital camera?

I have problem doing it with WIA. It gives me error right from

Imports WIALib

and it underline any thing i call from that library. I am using VB.NET 2008

my email is ntagrafix@yahoo.com



hello Fabio!

i have the same issue (with delphi6 and nikon d3000). I would like two cameras to take photo at the same time.
but now I have to open the connection to the cameras before each shot (because of multithread. with only one camera I can take photo immediately, I open the connection at the starting, and without threading), and it takes 2-3 seconds, and they start and finish not the same time :(
have you any idea, how to solve this? and how did you solve your problem?
to exe-starting,I also tried this, but it was the same result, before each shot I have to connect to the camera. Or how did you do this?



You could cheat a little and create buttons for each take picture, then hide them.

Then create one more button, and on that button.click event call the:



They wont be EXACTLY the same time, but they will be extremely close.


I'm not sure if anyone still reads this but I would like to do the same thing with scanners :

scan from scanner1
scan from scanner2

wait 60minutes

scan from scanner1
scan from scanner2


all automatically.
I managed to have the first scan but then it looks like the connection with the scanners remains active because for the second scan, when scanner 1 is supposed to scan, scanner #2 starts flashing and remains blocked like that for ever, without scanning.
It looks like WIA is happy to switch from scanner 1 to 2 but refuses to come back to scanner 1 for the next round.

I'm not sure I can post a link, but I have tried so many thing that if I post everything here, my post would be 2km long.
Can anyone help me with that, i'm a little desperate right now.

This article has been dead for over six months: Start a new discussion instead
Start New Discussion
View similar articles that have also been tagged: