Partager via


PushRouter_GetMessage

4/8/2010

This function passes the message to the push router client.

Syntax

HRESULT PushRouter_GetMessage(
  HPUSHROUTER hPushRouter,
  LPPUSHMSG pPushMsg
);

Parameters

  • hPushRouter
    [in] Handle to the push router.
  • pPushMsg
    [out] Pointer to a PUSHMSG structure representing the message that is provided by the push router.

Return Value

Returns S_OK if successful. If the function is unsuccessful, it can return a standard Windows HRESULT value or one of the push router-specific HRESULT values that are shown in the following table.

Value Description

PUSHRTR_E_EXCEPTION

An exception occurred in the push router function.

PUSHRTR_S_NOMESSAGEPENDING

No messages are pending in the client queue.

Remarks

Confighost waits only one time on hevtMsgAvailable received from PushRouter_Open. To process push router messages, wait for hevtMsgAvailable in a loop while PushRouter_Open succeeds and the return value from PushRouter_GetMessage is not PUSHRTR_S_NOMESSAGEPENDING. The following code snippet is an example of a loop to process push router messages.

while (WAIT_OBJECT_0 == WaitForSingleObject(hevtMsgAvailable, 10000)) 
{
    // Inner loop gets and processes available messages.
    for (;;)
    {
         hr = PushRouter_GetMessage(hPushRouter, &PushMsg);
         if (PUSHRTR_S_NOMESSAGESPENDING == hr)
         {
              // Message was not available.
              // Exit inner loop and wait for message.
              break;
         }
         CHR(hr);

         hr = HandleMessage(&PushMsg);
         CHR(hr);

         PushRouter_FreeMessage(&PushMsg);
         memset(&PushMsg, 0, sizeof(PUSHMSG));
         PushMsg.cbSize = sizeof(PUSHMSG);
    }
}

For more information about Confighost, see Push Router.

Requirements

Header pushclient.h
Library Pushprxy.lib
Windows Embedded CE Windows CE .NET 4.2 and later
Windows Mobile Pocket PC for Windows Mobile 2003 and later, Smartphone for Windows Mobile 2003 and later

See Also

Reference

PushRouter_FreeMessage
PUSHMSG