views:

1643

answers:

2

I'm using VS2008 SP1 under Vista SP1. My .Net-program uses a COM reference to WIA (Microsoft Windows Image Acquisition Library v2.0). I'm using CommonDialogClass.ShowAcquireImage to scan a document and it's working fine. One of my customers is running XP. As I understand WIA, under XP you have to use WIALib (WIA 1.0). Is it possible to develop under Vista using WIA1?

A: 

You can, in general. However, you will still need to have the WIA1 Dlls on your Vista system. The way I've done this in the past is to copy the WIA1 Dlls from XP to the XP box. I don't register the WIA1 dlls, but just reference them. By referencing them, your code now uses WIA1. In theory, you can still run and test on Vista because WIA2 should be backwards compatible with WIA1. Although you should test with XP just to be sure.

If you don't have another machine, I would recommend you take a look at VMWare so that you can install a new XP and get the Dlls that way.

Tommy Hui
Thanks, I will test this tomorrow. Luckily I can install a machine with XP. Being honest, I run my Vista in a VM under Hyper-V on Windows Server 2008...
Lars
These are the Dlls I found on my XP:wiadefui.dllwiadss.dllwiascr.dllwiaservc.dllwiashext.dllwiavideo.dllwiavusd.dllNone of them seems to be the one for "WIALib". Any suggestions?
Lars
I would use the "dumpbin.exe /exports wiadefui.dll" on each of those DLLs to see which one exports DllGetClassObject. This would indicate the DLL is a COM DLL.
Tommy Hui
Sadly, that doesn't work. Though some of the Dlls exports DllGetClassObject, I can't reference them. VS2008 says, I have to check if it's a valid assembly or COM-component (I only have german error messages, so I don't know "the original" one). I guess I will install a VS under XP...
Lars
+1  A: 

I setup a small WIALib-project with VS2008 under Windows XP and copied the created Interop.WIALib.dll to my Vista machine. When I reference this file in a C# project, I can compile it. Now I have two projects, one for XP and one for Vista. With a GetVersionEx-call I determine the running Windows-version in my C++-program and call the method of the adequate Dll.

Lars