SetPrinterUISettings VC++ Example
void CEPrintDemoView::OnSetPrinterUISettings()
{
IEpnUISettings * pUISettings;
IEPrint * pLeadPrnt;
HRESULT hr;
hr = ::CoCreateInstance(CLSID_EPrint, NULL, CLSCTX_ALL, IID_IEPrint, (void**) &pLeadPrnt);
if(FAILED(hr))
return;
hr = ::CoCreateInstance(CLSID_EpnUISettings, NULL, CLSCTX_ALL, IID_IEpnUISettings, (void**) &pUISettings);
if(FAILED(hr))
return;
if (pLeadPrnt->IsSupportLocked(SUPPORT_OEM))
pLeadPrnt->UnlockSupport(SUPPORT_OEM, OEM_KEY);
pUISettings->AboutString = "about string";
pUISettings->AboutIcon = "C:\\Program Files\\OEM eprint\\ICON.ICO";
pUISettings->ShowOptions = HIDE_PAPER_TAB | HIDE_GRAPHICS_TAB;
pUISettings->FormatsCount = 4;
pUISettings->GetSaveFormats(0)->DocumentType = FT_SAVE_TYPE_RASTER;
pUISettings->GetSaveFormats(0)->Format= FILE_CMP;
pUISettings->GetSaveFormats(1)->DocumentType = FT_SAVE_TYPE_RASTER;
pUISettings->GetSaveFormats(1)->Format = FILE_JPEG;
pUISettings->GetSaveFormats(2)->DocumentType = FT_SAVE_TYPE_VECTOR;
pUISettings->GetSaveFormats(2)->Format = FILE_EMF;
pUISettings->GetSaveFormats(3)->DocumentType = FT_SAVE_TYPE_RASTER;
pUISettings->GetSaveFormats(3)->Format = FILE_PDF;
pLeadPrnt->SetPrinterUISettings(TEST_PRINTER_NAME, pUISettings);
if(pUISettings)
{
pUISettings->Release();
pUISettings = NULL;
}
if(pLeadPrnt)
{
pLeadPrnt->Release();
pLeadPrnt = NULL;
}
}