Hi Si,
Thanks for your reply. I tried using SetJob() with JOB_INFO_2
structure to display the windows defined status, but that is also not
getting displayed. I am attaching the code here
DWORD dwNeeded, dwReturned, i;
JOB_INFO_2 *pJobInfo;
DWORD *pStatus;
int nJobId = 0;
// First you call EnumJobs() to find out how much memory you need
if( ! EnumJobs( pIniPort->pIniJob->hPrinter, 0, 0xFFFFFFFF, 1, NULL,
0, &dwNeeded, &dwReturned ) )
{
// It should have failed, but if it failed for any reason other
// than “not enough memory”, you should bail out
if( GetLastError() != ERROR_INSUFFICIENT_BUFFER )
{
ClosePrinter( pIniPort->pIniJob->hPrinter);
return FALSE;
}
}
// Allocate enough memory for the JOB_INFO_2 structures plus
// the extra data - dwNeeded from the previous call tells you
// the total size needed
if( (pJobInfo = (JOB_INFO_2 *)malloc( dwNeeded )) == NULL )
{
ClosePrinter( pIniPort->pIniJob->hPrinter );
return FALSE;
}
ZeroMemory(pJobInfo, dwNeeded);
// Call EnumJobs() again and let it fill out our structures
if( ! EnumJobs( pIniPort->pIniJob->hPrinter, 0, 0xFFFFFFFF, 1,
(LPBYTE) pJobInfo, dwNeeded, &dwNeeded, &dwReturned ) )
{
ClosePrinter( pIniPort->pIniJob->hPrinter );
free( pJobInfo );
pJobInfo=NULL;
return FALSE;
}
// You’re done with the printer handle, close it
ClosePrinter( pIniPort->pIniJob->hPrinter );
// dwReturned tells how many jobs there are
// Here, you’ll simply display the number of jobs found
printf( “%d jobs\n”, dwReturned );
// It’s easy to loop through the jobs and access each one
pJobInfo->Status = JOB_STATUS_PAPEROUT;
if ( !SetJob(pIniPort->pIniJob->hPrinter, nJobId, 2,
(LPBYTE)&pJobInfo, 0) )
{
DBGMSG(DBG_WARNING,
(“pjlmon: SetJob failed %d (LE: %d)\n”,
pIniPort->PrinterStatus, GetLastError()));
}
Please help me in this regard. Thanks in advance.
Regards,
Karunya Lakshmi.M
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Simon Owen
Sent: Saturday, December 02, 2006 7:57 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Printer’s SetPort function is not working
On 27/11/06, xxxxx@wipro.com
wrote:
> When I searched in the net I found that it is a Microsoft bug with
SetPort
> function and it won’t work for customized status messages.
> If so, Could anyone tell me if there is any alternate solution for
> displaying customized messages?
I also found that SetPort() failed to allow custom status text in
W2K/XP. However, SetJob() does work to display job-specific text in
the Status column in the print queue. Perhaps using SetPort with
PORT_STATUS_USER_INTERVENTION together with SetJob for your custom
text will give you close to what you need?
Best regards,
Si
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer