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);