Use CreatePrintAsyncNotifyChannel to communicate from Server Port to Client Driver
-
I am developing a printer driver. Now i have to communicate the error from server to driver. I will explain step for step. The printer is installed on the printserver and is shared to the client. This client gets the driver from the server and works fiine. Now one applicatioin from client prints some document from the server. The printjob arrives on the server and is managed by the print monitor on the server. Anything goes wrong. How to get the errormessage to the client? Or any errormessage to the client? If the printer is installed locale on the client, i use CreatePrintAsyncNotifyChannel to create the error-message-ballon on the desktop. But if i am a shared printer i get no baloonmassage on Client nor on the server. So how to communicate from server to client. Code for the balloning: IPrintAsyncNotifyChannel *pIAsynchNotification = NULL; CreatePrintAsyncNotifyChannelProc pfnIPC = (CreatePrintAsyncNotifyChannelProc)GetProcAddress(hWinSpoolDrv, "CreatePrintAsyncNotifyChannel"); if (pfnIPC != NULL) { HRESULT hr = pfnIPC( cPrinterName, const_cast<GUID*>(&MS_ASYNCNOTIFY_UI), kPerUser, kUniDirectional,// kBiDirectional, // NULL, &pIAsynchNotification ); DWORD dwErr = HRESULT_CODE(hr); if (pIAsynchNotification) { wchar_t cMessageBody[2048] = L"<?xml version=\"1.0\" ?>"\ L"<asyncPrintUIRequest xmlns=\"http://schemas.microsoft.com/2003/print/asyncui/v1/request\\">"\\ L"<v1><requestOpen><balloonUI><title>"; wcscat_s(cMessageBody,cPrinterName); wcscat_s(cMessageBody,L"</title><body>"); wcscat_s(cMessageBody,cErrMsg); wcscat_s(cMessageBody,L"</body></balloonUI></requestOpen></v1></asyncPrintUIRequest>"); CPrintOEMAsyncNotifyDataObject *pClientNotification = new CPrintOEMAsyncNotifyDataObject(reinterpret_cast<BYTE*>(cMessageBody), sizeof(cMessageBody), const_cast<GUID*>(&MS_ASYNCNOTIFY_UI)); if (pClientNotification) { pIAsynchNotification->SendNotification(pClientNotification); bErrorSend =