win xp系统下开发扫描仪程序,在win7中运行提示“没有找到设备”?怎么回事
c++ builder开发的扫描仪程序,在xp下完好运行,最近换成win7系统后,问题出现在selectDeviceDlg()函数的返回值是WIA_S_NO_DEVICE_AVAILABL。在xp系统下是可以选择设备的,在win7中不能?有人知道原因吗?
IWiaItem* SZLWia::selectDevice(IWiaDevMgr *pWiaDevMgr)C++ Windows?XP Windows?7
{
// Display a WIA select device dialogd
try
{
IWiaItem *pItemRoot = NULL;
HResult hResult;
hResult = pWiaDevMgr->SelectDeviceDlg(NULL, 0, WIA_SELECT_DEVICE_NODEFAULT,
NULL, &pItemRoot);
if(hResult == S_OK)
return pItemRoot;
// User canceled
else if(hResult == S_FALSE)
{
MessageBox(GetActiveWindow(), "User canceled.", NULL, MB_ICONINFORMATION);
return NULL;
}
// No device available
else if(hResult == WIA_S_NO_DEVICE_AVAILABL)
{
MessageBox(GetActiveWindow(), "No device available.", NULL, MB_ICONINFORMATION);
return NULL;
}
}
catch(...)
{
MessageBox(GetActiveWindow(),"error",NULL, MB_OK|MB_ICONERROR);
}
}