Please help me to find out the problem in GetPrinter function.
First I am trying to get the printer handle for the specified printer using OpenPrinter function. .
HANDLE hPrinter = 0;
OpenPrinter ((LPTSTR)(LPCTSTR)strPrinterAddress, &hPrinter, NULL);
This function gets succeed. Using this printer handle I am trying to access the specified printer information’s using the GetPrinter function.
GetPrinter(hPrinter, 2, NULL, 0, &dwNeeded);
DWORD dwError = ::GetLastError();
ClosePrinter( hPrinter );
Even using GetLastError() function I am not able retrieve error message. This function is not failing all the times. When I am trying to print out of 10 times, 6 times the printing is succeed. Only 4 times it’s getting failed. Please help me shoot out this problem.
modified on Tuesday, October 14, 2008 4:08 AM