GetCapability Example for C++ 5.0 and later

ILEADRasterTwain_U * pRasterTwain;
short iRet; 
ICapability_U * pICapability;

HRESULT hr = ::CoCreateInstance(CLSID_LEADRasterTwain_U, NULL, CLSCTX_ALL, IID_ILEADRasterTwain_U, (void **)&pRasterTwain);
pRasterTwain->InitSession((long)GetSafeHwnd()); 
pRasterTwain->SelectSource();
 
CoCreateInstance (CLSID_LEADRasterTwainCapability_U, NULL, CLSCTX_ALL, IID_ICapability_U, (void **)&pICapability); 
pICapability->put_ConType (L_TWON_DONTCARE16); 
pICapability->put_Capability (L_ICAP_UNITS); 

iRet = pRasterTwain->GetCapability (pICapability, L_LTWAIN_CAPABILITY_GETCURRENT); 
if (iRet) 
{
	return iRet; 
}