RE: StartDocPort and DOC_INFO_1 by AlexeyGavrilov
AlexeyGavrilov
Wed Sep 07 05:35:05 CDT 2005
Hello Meier,
You may try to use unique document name to set redirection. Your port
monitor may recognize the name of the document, read the data and decide what
to do.
if(OpenPrinter(szPrinterName, &hPrinter, NULL))
{
DOC_INFO_1 di;
memset(&di, 0, sizeof(di));
di.pDocName=szDocName;
di.pDatatype="RAW";
if(SP_ERROR!=StartDocPrinter(hPrinter, 1, (LPBYTE)&di))
{
DWORD dwBytes=0;
WritePrinter(hPrinter, szDocName, strlen(szDocName)+1, &dwBytes);
WritePrinter(hPrinter, lpAnyData, dwSizeOfData, &dwBytes);
EndDocPrinter(hPrinter);
}
// Print your document now
ClosePrinter(hPrinter);
}
Regards,
Alexey
"Meier Rudolf" wrote:
> Hi
>
> I'm writing a port monitor. It's a kind of a redirector port and I have to
> tell him where to redirect the data to. This is done using a GUID. So I have
> to give him a GUID. I thought about doing this in the pOutputFile of the
> DOC_INFO_1/2 struct. Since this is a "caller supplied pointer", it should
> work. But the MSDN also says: pOutputFile: ... To print to a printer, set
> this to NULL. ... now, I want to print to a "printer", but I still don't
> want to set this to NULL... does someone know if this is OK, or should I try
> to find an other solution? Does Windows redirect the job to somewhere else,
> if I don't pass NULL in this parameter?
>
> thanks
> MR
>
>
>