Compartilhar via


SmsSendMessage

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function creates and sends a Short Message Service (SMS) message.

Syntax

HRESULT SmsSendMessage (
    const SMS_HANDLE   smshHandle,
    const SMS_ADDRESS* psmsaSMSCAddress,
    const SMS_ADDRESS* psmsaDestinationAddress,
    const SYSTEMTIME*  pstValidityPeriod,
    const BYTE*        pbData,
    const DWORD        dwDataSize,
    const BYTE*        pbProviderSpecificData,
    const DWORD        dwProviderSpecificDataSize,
    const SMS_DATA_ENCODING smsdeDataEncoding,
    const DWORD        dwOptions,
  SMS_MESSAGE_ID*    psmsmidMessageID
);

Parameters

  • smshHandle
    An SMS handle obtained from calling SmsOpen.
  • psmsaSMSCAddress
    An optional parameter indicating which Short Message Service Center (SMSC) the message will be routed through. If NULL (recommended), the user's default SMSC will be used.
  • psmsaDestinationAddress
    The destination of the message.
  • pstValidityPeriod
    The duration for which the SMS message is valid, counted from when the SMSC receives the message. This can be NULL. This is not interpreted as a normal SYSTEMTIME structure. See GSM specification 03.40 "Digital cellular telecommunications system (Phase 2+); Technical realization of the Short Message Service (SMS)" for more detail.
  • pbData
    The data portion of the message. This can be NULL.
  • dwDataSize
    Size in bytes of the buffer pointed to by pbData. This can be zero.
  • pbProviderSpecificData
    For certain providers, a provider-specific structure must be provided in addition to the previous data buffer.
  • dwProviderSpecificDataSize
    Size of pbProviderSpecificData.
  • smsdeDataEncoding
    The text encoding of the SMS message, if appropriate. SMSDE_OPTIMAL is the recommended value. See the SMS_DATA_ENCODING enumeration for possible values.
  • dwOptions
    Optional flags.

    Value Description

    SMS_OPTION_DELIVERY_NONE

    No special options

    SMS_OPTION_DELIVERY_NO_RETRY

    Unless this option is specified, the router will retry sending the SMS message according to a pre-defined short-term retry schedule. If this option is specified, no retries will be attempted.

  • psmsmidMessageID
    If not NULL, this will point to a message ID on successful return from SmsSendMessage. This identifier can be used with SmsGetMessageStatus to identify the message.

Return Value

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

  • S_OK
    The method completed successfully.

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

Requirements

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

Reference

SmsOpen
SMS_DATA_ENCODING
SmsGetMessageStatus

Concepts

Short Message Service Functions