Capability Example for C++ 5.0 and later
ILEADRasterTwain * pltRasTwain;
long lCount;
long lCapability;
ILEADRasterVariant * CapVal = NULL;
CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL,
IID_ILEADRasterVariant, (void **)&CapVal);
ICapability * pCapability = NULL;
ICapabilityOneValue * pCapOV = NULL;
::CoCreateInstance (CLSID_LEADRasterTwainCapability, NULL, CLSCTX_ALL, IID_ICapability, (void **)&pCapability);
pCapability->QueryInterface (IID_ICapabilityOneValue, (void **)&pCapOV);
pltRasTwain->get_CapsCount(&lCount);
for (long n = 0 ; n < lCount ; n++)
{
pltRasTwain->get_Capability(n, &lCapability);
// Check for capability and do other processing
if (lCapability == L_ICAP_XFERMECH)
{
pCapability->EnableMethodErrors = FALSE;
pCapability->Capability = L_ICAP_XFERMECH;
pCapability->ConType = L_TWON_ONEVALUE;
CapVal->Type = VALUE_USHORT;
CapVal->LongValue = L_TWSX_FILE;
pCapOV->put_OneValItemType(L_TWTY_UINT16);
pCapOV->put_OneValCapValue(CapVal);
pltRasTwain->SetCapability(pCapability, L_LTWAIN_CAPABILITY_SET);
}
}
CapVal->Release();