I saw this way of coding in Microsoft " WIA tutorial " page but the vc++ doesn't let me to compile it! some errors appear all the time!
#include "stdafx.h"
#include <Strsafe.h>
#include <Wia.h>
#include <WinError.h>
bool CreateWiaDeviceManager( IWiaDevMgr2 **ppWiaDevMgr ){
//
// Validate arguments
//
if (NULL == ppWiaDevMgr)
{
return E_INVALIDARG;
}
//
// Initialize out variables
//
*ppWiaDevMgr = NULL;
//
// Create an instance of the device manager
//
//Vista or later:
HRESULT hr = CoCreateInstance( CLSID_WiaDevMgr2, NULL, CLSCTX_LOCAL_SERVER, IID_IWiaDevMgr2, (void**)ppWiaDevMgr );
//
// Return the result of creating the device manager
//
return SUCCEEDED(hr);
}
There are errors:
1>WIAScanner.cpp(11): error C2065: 'IWiaDevMgr2' : undeclared identifier 1>WIAScanner.cpp(11): error C2065: 'ppWiaDevMgr' : undeclared identifier 1>WIAScanner.cpp(11): error C2448: 'CreateWiaDeviceManager' : function-style initializer appears to be a function definition
Thanks for your attention.
IWiaDevMgr2
is only available in Windows Vista or later, so you need to target your project appropriately: _WIN32_WINNT
needs to be defined as 0x0600
or greater.