I'm printing using CreateDC, passing in a valid DEVMODE structure and getting NULL returned which i开发者_JS百科ndicates an error but GetLastError returns 0.
m_hDC = ::CreateDC(L"WINSPOOL", PrinterName, NULL, pDevMode);
if (m_hDC == NULL)
{
throw Exception(GetLastError(), __LINE__, _T(__FILE__));
}
This is working for all of my customers apart from one, any ideas?
This turned out to be a problem with the thunking spooler api's.
The software is a 32 bit Windows service running on a 64 bit system.
It seems that only one user/session can print at a time from a 32 bit process, the next user has to wait for splwow64.exe to timeout (or kill it) before they can print.
It is covered in a technote from MS.
Are you sure that pDevMode is valid? You could try using a NULL pointer here in case the DEVMODE is the issue.
精彩评论