Windows Image Acquisition from managed C++?

R

Ryan Melville

Hi,

I need to use WIA (Windows Image Acquisition) from managed C++. Is there a
"new and improved" way to access WIA from managed C++ (i.e., through .net)?
Or, is it the same COM calls as from unmanaged C++?

If it's the same COM calls, is there a "new and improved" way to access COM
through managed C++? Or, do I do the same CComPtr magic as with unmanaged
C++? Or, can I not use ATL facilities from managed C++ and I would have to
regress all the way back to ::CoCreateInstance() et. al.?

Thanks for any help! The best I can find in the docs suggests I need a
Primary Interop Assembly for WIA in order to use .NET Interop but I can't
find a PIA for WIA so I must be on the wrong track.

Thanks,
Ryan
 
R

Ryan Melville

I figured it out.

For posterity:

- Use Visual Studio "Add Reference"...
- Select COM tab.
- Select "Microsoft Windows Image Acquisition".
- This will generate some objects in an Interop::WIALib namespace.

You can then do something like this:

WiaClass* pWia = new WiaClass();

int iCnt = pWia->Devices->Count;


See the WIA documentation and use the "Open" menu item from the right-click
menu of the WIALib reference in your project to see documentation on the
generated classes/interfaces/et. al.

Seems to work well.

Ryan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top