Hi,
I've signed the .exe with a signed certificate and it is still not working.
When I use SmsSendMessage I am getting error code 120 which means 'function
is not supported on this platform' but I'm using API function in VC++ so not
sure why I'm getting this.
Please help.
Here is the code
HRESULT hr =0;
SMS_HANDLE smshHandle;
SMS_ADDRESS smscSource; // Short Message Service Center
SMS_ADDRESS smsDestination; // destination phone
TEXT_PROVIDER_SPECIFIC_DATA tpsd;
SMS_MESSAGE_ID smsmidMessageID;
TCHAR lpszMessage[500];
BOOL ret=FALSE;

if(wcslen(lpszRecipient) < 1 || wcslen(smsFormat) < 1)
{
m_setStateRetrySMS = TRUE;
m_setStateRetrySmsDoEncrypt = doEncrypt;

memset(m_setStateRetrySmsBody,0,sizeof(m_setStateRetrySmsBody));
wcscpy(m_setStateRetrySmsBody,body);

return TRUE;
}

FormatSMSData(lpszMessage,TEXT("T"),body,doEncrypt,smsFormat);

memset(&smscSource,0,sizeof(smscSource));
memset(&smsDestination,0,sizeof(smsDestination));
memset(&tpsd,0,sizeof(tpsd));
//
// open an SMS Handle in SEND mode
//
hr = SmsOpen(SMS_MSGTYPE_TEXT, SMS_MODE_SEND, &smshHandle, NULL);
if(hr)
{
#ifdef DEBUG
ProcessSmsErr(hr);
#endif
return FALSE;
}

//
// Create the source address
//
if(!bUseDefaultSMSC)
{
//
//
// Address Type
//
// SMSAT_UNKNOWN unknown phone number type.
// SMSAT_INTERNATIONAL international phone number.
// SMSAT_NATIONAL national phone number.
// SMSAT_NETWORKSPECIFIC network-specific phone number.
// SMSAT_SUBSCRIBER subscriber phone number.
// SMSAT_ALPHANUMERIC alphanumeric phone number.
// SMSAT_ABBREVIATED abbreviated phone number.


smscSource.smsatAddressType = SMSAT_INTERNATIONAL;
//
// Copy
//
_tcsncpy(smscSource.ptsAddress, lpszSMSC, SMS_MAX_ADDRESS_LENGTH);
}

//
// Create the destination address
//

smsDestination.smsatAddressType = SMSAT_INTERNATIONAL;
_tcsncpy(smsDestination.ptsAddress, lpszRecipient, SMS_MAX_ADDRESS_LENGTH);

//
// Set up provider specific data
//

tpsd.dwMessageOptions = bSendConfirmation ? PS_MESSAGE_OPTION_STATUSREPORT
: PS_MESSAGE_OPTION_NONE;
tpsd.psMessageClass = PS_MESSAGE_CLASS1;
tpsd.psReplaceOption = PSRO_NONE;

//
// Send the message, indicating success or failure
//

hr = SmsSendMessage(smshHandle,
((bUseDefaultSMSC) ? NULL : &smscSource),
&smsDestination,
NULL, // validity
(PBYTE) lpszMessage, // message
_tcslen(lpszMessage) * sizeof(TCHAR), // message len in bytes
(PBYTE) &tpsd,
sizeof(TEXT_PROVIDER_SPECIFIC_DATA),
SMSDE_OPTIMAL, // SMSDE_OPTIMAL - default specified in GSM
// SMSDE_GSM - GSM 7-bit encoding
// SMSDE_UCS2 - Unicode UCS2
SMS_OPTION_DELIVERY_NONE, // retry
&smsmidMessageID);

Re: smssendmessage not working by Peter

Peter
Tue Apr 03 04:12:14 CDT 2007

What platform are you using? What exact device?

Peter

--
Peter Foot
Device Application Development MVP
www.peterfoot.net | www.inthehand.com

"vishal" <vishal@discussions.microsoft.com> wrote in message
news:79F281D4-9038-47B8-A425-E0C9D520664A@microsoft.com...
> Hi,
> I've signed the .exe with a signed certificate and it is still not
> working.
> When I use SmsSendMessage I am getting error code 120 which means
> 'function
> is not supported on this platform' but I'm using API function in VC++ so
> not
> sure why I'm getting this.
> Please help.
> Here is the code
> HRESULT hr =0;
> SMS_HANDLE smshHandle;
> SMS_ADDRESS smscSource; // Short Message Service Center
> SMS_ADDRESS smsDestination; // destination phone
> TEXT_PROVIDER_SPECIFIC_DATA tpsd;
> SMS_MESSAGE_ID smsmidMessageID;
> TCHAR lpszMessage[500];
> BOOL ret=FALSE;
>
> if(wcslen(lpszRecipient) < 1 || wcslen(smsFormat) < 1)
> {
> m_setStateRetrySMS = TRUE;
> m_setStateRetrySmsDoEncrypt = doEncrypt;
>
> memset(m_setStateRetrySmsBody,0,sizeof(m_setStateRetrySmsBody));
> wcscpy(m_setStateRetrySmsBody,body);
>
> return TRUE;
> }
>
> FormatSMSData(lpszMessage,TEXT("T"),body,doEncrypt,smsFormat);
>
> memset(&smscSource,0,sizeof(smscSource));
> memset(&smsDestination,0,sizeof(smsDestination));
> memset(&tpsd,0,sizeof(tpsd));
> //
> // open an SMS Handle in SEND mode
> //
> hr = SmsOpen(SMS_MSGTYPE_TEXT, SMS_MODE_SEND, &smshHandle, NULL);
> if(hr)
> {
> #ifdef DEBUG
> ProcessSmsErr(hr);
> #endif
> return FALSE;
> }
>
> //
> // Create the source address
> //
> if(!bUseDefaultSMSC)
> {
> //
> //
> // Address Type
> //
> // SMSAT_UNKNOWN unknown phone number type.
> // SMSAT_INTERNATIONAL international phone number.
> // SMSAT_NATIONAL national phone number.
> // SMSAT_NETWORKSPECIFIC network-specific phone number.
> // SMSAT_SUBSCRIBER subscriber phone number.
> // SMSAT_ALPHANUMERIC alphanumeric phone number.
> // SMSAT_ABBREVIATED abbreviated phone number.
>
>
> smscSource.smsatAddressType = SMSAT_INTERNATIONAL;
> //
> // Copy
> //
> _tcsncpy(smscSource.ptsAddress, lpszSMSC, SMS_MAX_ADDRESS_LENGTH);
> }
>
> //
> // Create the destination address
> //
>
> smsDestination.smsatAddressType = SMSAT_INTERNATIONAL;
> _tcsncpy(smsDestination.ptsAddress, lpszRecipient,
> SMS_MAX_ADDRESS_LENGTH);
>
> //
> // Set up provider specific data
> //
>
> tpsd.dwMessageOptions = bSendConfirmation ? PS_MESSAGE_OPTION_STATUSREPORT
> : PS_MESSAGE_OPTION_NONE;
> tpsd.psMessageClass = PS_MESSAGE_CLASS1;
> tpsd.psReplaceOption = PSRO_NONE;
>
> //
> // Send the message, indicating success or failure
> //
>
> hr = SmsSendMessage(smshHandle,
> ((bUseDefaultSMSC) ? NULL : &smscSource),
> &smsDestination,
> NULL, // validity
> (PBYTE) lpszMessage, // message
> _tcslen(lpszMessage) * sizeof(TCHAR), // message len in bytes
> (PBYTE) &tpsd,
> sizeof(TEXT_PROVIDER_SPECIFIC_DATA),
> SMSDE_OPTIMAL, // SMSDE_OPTIMAL - default specified in GSM
> // SMSDE_GSM - GSM 7-bit encoding
> // SMSDE_UCS2 - Unicode UCS2
> SMS_OPTION_DELIVERY_NONE, // retry
> &smsmidMessageID);
>


Re: smssendmessage not working by Herojit

Herojit
Tue Apr 03 07:57:27 CDT 2007

Hi,

I remember facing a similar problem. I used SMSAT_INTERNATIONAL for
smsatAddressType only when the recipient number has a preceding '+'
otherwise used SMSAT_UNKNOWN.

Regards,
Herojit


On Apr 3, 2:12 pm, "Peter Foot [MVP]" <feedb...@nospam-inthehand.com>
wrote:
> What platform are you using? What exact device?
>
> Peter
>
> --
> Peter Foot
> Device Application Development MVPwww.peterfoot.net|www.inthehand.com
>
> "vishal" <vis...@discussions.microsoft.com> wrote in message
>
> news:79F281D4-9038-47B8-A425-E0C9D520664A@microsoft.com...
>
> > Hi,
> > I've signed the .exe with a signed certificate and it is still not
> > working.
> > When I use SmsSendMessage I am getting error code 120 which means
> > 'function
> > is not supported on this platform' but I'm using API function in VC++ so
> > not
> > sure why I'm getting this.
> > Please help.
> > Here is the code
> > HRESULT hr =0;
> > SMS_HANDLE smshHandle;
> > SMS_ADDRESS smscSource; // Short Message Service Center
> > SMS_ADDRESS smsDestination; // destination phone
> > TEXT_PROVIDER_SPECIFIC_DATA tpsd;
> > SMS_MESSAGE_ID smsmidMessageID;
> > TCHAR lpszMessage[500];
> > BOOL ret=FALSE;
>
> > if(wcslen(lpszRecipient) < 1 || wcslen(smsFormat) < 1)
> > {
> > m_setStateRetrySMS = TRUE;
> > m_setStateRetrySmsDoEncrypt = doEncrypt;
>
> > memset(m_setStateRetrySmsBody,0,sizeof(m_setStateRetrySmsBody));
> > wcscpy(m_setStateRetrySmsBody,body);
>
> > return TRUE;
> > }
>
> > FormatSMSData(lpszMessage,TEXT("T"),body,doEncrypt,smsFormat);
>
> > memset(&smscSource,0,sizeof(smscSource));
> > memset(&smsDestination,0,sizeof(smsDestination));
> > memset(&tpsd,0,sizeof(tpsd));
> > //
> > // open an SMS Handle in SEND mode
> > //
> > hr = SmsOpen(SMS_MSGTYPE_TEXT, SMS_MODE_SEND, &smshHandle, NULL);
> > if(hr)
> > {
> > #ifdef DEBUG
> > ProcessSmsErr(hr);
> > #endif
> > return FALSE;
> > }
>
> > //
> > // Create the source address
> > //
> > if(!bUseDefaultSMSC)
> > {
> > //
> > //
> > // Address Type
> > //
> > // SMSAT_UNKNOWN unknown phone number type.
> > // SMSAT_INTERNATIONAL international phone number.
> > // SMSAT_NATIONAL national phone number.
> > // SMSAT_NETWORKSPECIFIC network-specific phone number.
> > // SMSAT_SUBSCRIBER subscriber phone number.
> > // SMSAT_ALPHANUMERIC alphanumeric phone number.
> > // SMSAT_ABBREVIATED abbreviated phone number.
>
> > smscSource.smsatAddressType = SMSAT_INTERNATIONAL;
> > //
> > // Copy
> > //
> > _tcsncpy(smscSource.ptsAddress, lpszSMSC, SMS_MAX_ADDRESS_LENGTH);
> > }
>
> > //
> > // Create the destination address
> > //
>
> > smsDestination.smsatAddressType = SMSAT_INTERNATIONAL;
> > _tcsncpy(smsDestination.ptsAddress, lpszRecipient,
> > SMS_MAX_ADDRESS_LENGTH);
>
> > //
> > // Set up provider specific data
> > //
>
> > tpsd.dwMessageOptions = bSendConfirmation ? PS_MESSAGE_OPTION_STATUSREPORT
> > : PS_MESSAGE_OPTION_NONE;
> > tpsd.psMessageClass = PS_MESSAGE_CLASS1;
> > tpsd.psReplaceOption = PSRO_NONE;
>
> > //
> > // Send the message, indicating success or failure
> > //
>
> > hr = SmsSendMessage(smshHandle,
> > ((bUseDefaultSMSC) ? NULL : &smscSource),
> > &smsDestination,
> > NULL, // validity
> > (PBYTE) lpszMessage, // message
> > _tcslen(lpszMessage) * sizeof(TCHAR), // message len in bytes
> > (PBYTE) &tpsd,
> > sizeof(TEXT_PROVIDER_SPECIFIC_DATA),
> > SMSDE_OPTIMAL, // SMSDE_OPTIMAL - default specified in GSM
> > // SMSDE_GSM - GSM 7-bit encoding
> > // SMSDE_UCS2 - Unicode UCS2
> > SMS_OPTION_DELIVERY_NONE, // retry
> > &smsmidMessageID);