EndSession Example for C++ 5.0 and later

ILEADRasterTwain_U * pRasterTwain;

HRESULT hr = ::CoCreateInstance(CLSID_LEADRasterTwain_U, NULL, CLSCTX_ALL, IID_ILEADRasterTwain_U, (void **)&pRasterTwain);

pRasterTwain->InitSession((long)GetSafeHwnd());
pRasterTwain->SelectSource();
pRasterTwain->Acquire(L_LTWAIN_SHOW_USER_INTERFACE);
pRasterTwain->EndSession();