SmsOpen

Send Feedback

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.

HRESULT SmsOpen (
const LPCTSTR ptsMessageProtocol,
const DWORD dwMessageModes,
SMS_HANDLE* const psmshHandle,
HANDLE* const 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, WaitForMultipleObjects, 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 Values

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

Smartphone: Smartphone 2002 and later
Pocket PC: Pocket PC 2002 and later
OS Versions: Windows CE 3.0 and later
Header: sms.h
Library: sms.lib

See Also

Short Message Service Functions | SmsClose

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.