HANDLE hPrinter = NULL;
DWORD dwSize = 25;
char szBuffer[25];
PRINTER_INFO_8* pi8 = NULL;
PRINTER_INFO_2* pi2 = NULL;
DOCINFO di = {0};
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = "Bitmap Printing Test";
GetDefaultPrinter(szBuffer, &dwSize);
OpenPrinter (szBuffer, &hPrinter, NULL);
BOOL bRes = GetPrinter(hPrinter,8, NULL, 0, &dwSize);
pi8 = (PRINTER_INFO_8*)new BYTE[dwSize];
ZeroMemory(pi8, dwSize);
bRes = GetPrinter(hPrinter,8, (LPBYTE)pi8, dwSize, &dwSize);
HDC hDCPrint = CreateDC("WINSPOOL", szBuffer, NULL, pi8->pDevMode);
StartDoc(hDCPrint, &di);
StartPage(hDCPrint);
TextOut(hDCPrint, 0, 0, "test text", 9);
EndPage(hDCPrint);
EndDoc(hDCPrint);
DeleteDC(hDCPrint);
GetPrinter(hPrinter, 2, NULL, 0, &dwSize);
pi2 = (PRINTER_INFO_2*)new BYTE[dwSize];
GetPrinter(hPrinter, 2, (LPBYTE)pi2, dwSize, &dwSize);
if (pi2->cJobs)
cout<<"printer is busy"<<endl;
else
cout<<"printer is free"<<endl;
delete [](BYTE*)pi8;
delete [](BYTE*)pi2;
ClosePrinter(hPrinter);
окончание печати - как узнать?
собственно и весь вопрос - отправил на печать что-то - как узнать, что печать окончена?
и всё таки :)