Share via


SmsOpen

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

Use this function to open the Short Message Service (SMS) Messaging component for send and/or receive access. If the specified provider cannot support the requested action (read or write), then the call to SmsOpen will return an error.

Syntax

HRESULT SmsOpen (
    const LPCTSTR      ptsMessageProtocol,
    const DWORD        dwMessageModes,
    const SMS_HANDLE*  psmshHandle,
    const HANDLE*      phMessageAvailableEvent);

Parameters

  • ptsMessageProtocol
    Points to a string that indicates which SMS protocol to use.
  • dwMessageModes
    The send and/or receive mode. This parameter can be any combination of the following values:

    Value Description

    SMS_MODE_RECEIVE

    Receive mode.

    SMS_MODE_SEND

    Send mode.

  • psmshHandle
    If SmsOpen returns successfully, this parameter is an SMS handle to use for subsequent read/write commands.
  • phMessageAvailableEvent
    A Microsoft® Win32® event handle that is signaled when a new message is available to be read. Applications may wait on this handle by calling suitable Win32 APIs (WaitForSingleObject, MsgWaitForMultipleObjects, and so on), but should NOT use this handle with any other APIs (SetEvent, ResetEvent, and so on). Do not call CloseHandle on this event handle (that task will be performed by SmsClose).

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.

Remarks

Multiple clients can open an SMS handle for sending a specific SMS message type, but only one client can have a handle open for reading at a time. The event handle created by this function call should be waited on only — do not call any other event functions on this event handle. The event handle will be closed on calling SmsClose. Behavior is undefined if the user destroys this event instead of SmsClose.

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

SmsClose

Concepts

Short Message Service Functions