Share via


SmsGetProfile (Compact 2013)

3/26/2014

Deprecated.

This function retrieves the SMS_PROFILE information for a radio.

This function replaces the deprecated SmsGetBroadcastMsgRangesSmsGetPhoneNumber, and SmsGetSMSC functions.

Syntax

HRESULT SmsGetProfile(
    const DWORD dwRadioIndex,
    SMS_PROFILE *const psmpSmsProfile
);

Parameters

  • dwRadioIndex
    [in] The index of the radio to use.
  • psmpSmsProfile
    [in] A pointer to a storage area that the profile will be placed into.

    [out] A pointer to an SMS_PROFILE structure.

Return Value

HRESULT is S_OK for success, a standard error value, or one of the error constants defined in SMS Specific Errors.

Example

HRESULT     hr              = NOERROR;
SMS_PROFILE *psmpSmsProfile = NULL;
DWORD       RADIO_INDEX_1   = 1;
DWORD       dwSize          = sizeof( SMS_PROFILE );

psmpSmsProfile = ( SMS_PROFILE* ) malloc( dwSize );

memset( psmpSmsProfile, 0, dwSize);  
psmpSmsProfile->dwSize   = dwSize;
psmpSmsProfile->dwParams = SMS_PARAM_PROFILE_ALL;
        
hr = SmsGetProfile( RADIO_INDEX_1, psmpSmsProfile );

if ( SMS_E_BUFFERTOOSMALL == hr )
{
    dwSize = dwSize + sizeof( psmpSmsProfile->dwNumRanges * sizeof( SMS_RANGE ));
    psmpSmsProfile = ( SMS_PROFILE* ) realloc ( psmpSmsProfile, dwSize );
    memset( psmpSmsProfile, 0, dwSize);  
    psmpSmsProfile->dwSize   = dwSize);
    psmpSmsProfile->dwParams = SMS_PARAM_PROFILE_ALL;
    hr = SmsGetProfile( RADIO_INDEX_1, psmpSmsProfile );

Remarks

If the psmpSmsProfile storage area is too small to accommodate the SMS_PROFILE structure, SMS_E_BUFFERTOOSMALL will be returned. In this case, the dwNumRanges field of the SMS_PROFILE structure is valid and should be used to calculate the space required for the buffer. The original buffer should then be freed and a new buffer obtained. The call should then be repeated to get the entire profile. The buffer size calculation is: dwRequiredBufferSize = sizeof( SMS_PROFILE ) + psmp_Sms_Profile->dwNumRanges * sizeof( SMS_RANGE ), where psmp_Sms_Profile is the buffer used during the first call.

Requirements

Header

sms.h

Library

sms.lib

See Also

Reference

Short Message Service Functions
SmsOpen
SmsClose
SMS Message Mode Constants

Other Resources

WaitForSingleObject
MsgWaitForMultipleObjects
SetEvent
ResetEvent
CloseHandle