StartUp Example for C++ 5.0 and later
void CSample_COMDlg::OnButton1()
{
ILEADRasterDocument * pRasterDoc = NULL;
ILEADRaster * pRaster = NULL;
HRESULT hr = CoCreateInstance(CLSID_LEADRasterDocument, NULL, CLSCTX_ALL, IID_ILEADRasterDocument, (void**)&pRasterDoc);
if (FAILED(hr))
{
AfxMessageBox(TEXT("Can't instantiate the OCR COM Object..."));
return;
}
hr = CoCreateInstance(CLSID_LEADRaster, NULL, CLSCTX_ALL, IID_ILEADRaster, (void**)&pRaster);
if (FAILED(hr))
{
AfxMessageBox(TEXT("Can't instantiate the Main LEAD Raster Object..."));
pRaster->Release();
return;
}
// Unlock OCR support.
// Note that this is a sample key, which will not work in your toolkit.
pRaster->UnlockSupport(L_SUPPORT_OCR, "TestKey");
int nRet = pRasterDoc->StartUp ();
if (nRet == 0)
{
pRasterDoc->EnableMethodErrors = FALSE;
pRasterDoc->LoadSettingsFile ("c:\\OCRsetting.set");
FILL_METHOD fm = pRasterDoc->PageFillMethod;
if (fm != FM_HANDPRINT)
pRasterDoc->PageFillMethod = FM_HANDPRINT;
nRet = pRasterDoc->SaveSettingsFile ("c:\\OCRsetting.set");
if (nRet == 0)
AfxMessageBox(TEXT("The engine saved the updated settings to a file."));
else
AfxMessageBox(TEXT("The engine couldn't save the updated settings to a file."));
pRasterDoc->ShutDown ();
}
pRasterDoc->Release();
pRaster->Release();
}