I'm developing a v4 printer driver and I added a custom PRINTER_PROPERTY
to my gpd
file as follows:
*Feature: Pdl
{
*Name: "Printer Definition Language"
*FeatureType: PRINTER_PROPERTY
*PrintSchemaKeywordMap: "Pdl"
*DefaultOption: ps
*Option: ps
{
*Name: "Postscript"
}
*Option: pcl
{
*Name: "PCL"
}
}
I'm able to read its value in win 8 using IPrinterPropertyBag
interface, but what should I do in win 7?
Piece of code which works in Win8:
VARIANT qPropBag;
if (SUCCEEDED(m_pIPropertyBag->GetProperty(XPS_FP_QUEUE_PROPERTY_BAG, &qPropBag)))
{
auto pdisp = (IDispatch*)qPropBag.ppdispVal;
IPrinterPropertyBag * pBag;
if (SUCCEEDED(pdisp->QueryInterface<IPrinterPropertyBag>(&pBag)))
{
BSTR val;
if (SUCCEEDED(pBag->GetString(L"Config:Pdl", &val))) {
sFormat = val;
}
pBag->Release();
}
}
I found it by myself (and a help of MS guys ) and here is the code:
VARIANT helper;
if (SUCCEEDED(m_pIPropertyBag->GetProperty(L"IPrintCoreHelper", &helper))) {
IPrintCoreHelper * m_pCoreHelper;
if (SUCCEEDED(V_UNKNOWN(&helper)->QueryInterface(IID_IPrintCoreHelper, reinterpret_cast<VOID**>(&m_pCoreHelper)))) {
PCSTR val;
if (SUCCEEDED(m_pCoreHelper->GetOption(NULL, 0, "Pdl", &val)))
strcpy(sFormat, val); // usage
m_pCoreHelper->Release();
}
}
VariantClear(&helper);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.