A version of this page is also available for

Windows Embedded CE 6.0 R3


This function is used to read a previously received Short Message Service (SMS) message.


HRESULT SmsReadMessage (
  const SMS_HANDLE      smshHandle,
  SMS_ADDRESS* const    psmsaSMSCAddress,
  SMS_ADDRESS* const    psmsaSourceAddress,
  SYSTEMTIME* const     pstReceiveTime,
    bcount(dwBufferSize)  BYTE*  pbBuffer,
  DWORD                 dwBufferSize,
  bcount(dwProviderSpecificDataBuffer) BYTE* pbProviderSpecificBuffer,
  DWORD                 dwProviderSpecificDataBuffer,
  DWORD*                pdwBytesRead


  • smshHandle
    [in]A Short Message Service (SMS) handle obtained from calling SmsOpen.
  • psmsaSMSCAddress
    [in, out]Indicates the Short Message Service Center (SMSC) the message was routed through.
  • psmsaSourceAddress
    [in]The source of the message.
  • pstReceiveTime
    [in, out]The time of day that the message was received. This time stamp is in UTC (Coordinated Universal Time) format.
  • pbBuffer
    [out]The data buffer used to store the received SMS message.
  • dwBufferSize
    [in]Size, in bytes, of the buffer used for the received message. The buffer size to use can be determined by calling SmsGetMessageSize.
  • pbProviderSpecificBuffer
    [out]For certain providers, a provider-specific buffer must be provided in addition to the previous data buffer.
  • dwProviderSpecificDataBuffer
    [in]Size of pbProviderSpecificBuffer.
  • pdwBytesRead
    [out]Number of bytes that were read. This includes only the message data. It does not include the incoming addresses or time stamp.

Return Value

This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, and the following:

  • S_OK
    The method completed successfully.

For information about additional return values, see SMS Specific Errors.


For Windows Mobile

If It Is Possible, use the IMailRuleClient to read SMS messages instead of SmsReadMessage**. Using SmsReadMessage to read incoming messages may interfere with other MAPI clients and the Messaging (formerly Inbox) application.

Use SmsReadMessage when you want to replace Outlook Mobile for handling short messages, or you want to intercept a user-defined message type which is not handled by Outlook Mobile.**


Header sms.h
Library sms.lib
Windows Embedded CE Windows Embedded CE 6.0 and later
Windows Mobile Pocket PC 2002 and later, Smartphone 2002 and later

See Also




Short Message Service Functions