WaitForPrnPipe

 

Deprecated consider using WaitForPrnPipeWithPriority instead

 

#include “BLICECTR.H”

 

BOOL PASCAL WaitForPrnPipe(LPWSTR pszPipeName, HWND hMsgWnd, DWORD dwMessageNum);

Description

Starts the Pipe Message Capture thread. The thread receives messages from the Printer Driver through a named pipe, translates them to regular Window messages and sends them to the Window specified by hMsgWnd. This way the application can easily handle the pipe messages sent by the Printer Driver without directly dealing with the named pipe.

 

The WaitForPrnPipe function is non-blocking, it returns immediately after the Message Capture thread is created. To stop the Message Capture thread, the application should call EndWaitPrnPipe. The priority of the Message Capture thread can be set using the SetListeningPriority function.

Parameters

LPWSTR pszPipeName                - pointer to a NULL terminated UNICODE string that contains the pipe name, including the \\.\pipe\ prefix. To see how to construct the pipe name, refer to the Code Example section below.
HWND hMsgWnd                           - A Window handle. The BLICECTR.DLL will send window messages to this window. The message loop of the specified window should accept and handle the type of window messages that are specified in dwMessageNum.
DWORD dwMessageNum            - Message number. The message number of the window message to send, if a pipe message arrives. Can be any unused number above WM_USER, e.g: WM_USER + 1000.

Return value

TRUE if the message capture thread was started successfully, FALSE otherwise.

Programming Notes

The window that receives the messages must be created in the same process where the WaitForPrnPipe function is called.

Code Example

GetSessionID(lpDevMode, &dwSessionID);

swprintf(szPipeName, L"\\\\.\\pipe\\%s%d", GetInterfaceName(lpDevMode),dwSessionID);

WaitForPrnPipe(szPipeName, hWnd, WM_USER + 1000);