There seems to be very few real working examples for Sending / Receiving SMS text messages using eVC++ 4.2 or for PocketPC.
I found Douglas Boling's SMSTalk in his book, but unfortunately the code compiles but does not work.
Here is my abreviated SMS code that I'm using.
// try to open an SMS Handle
HREULST hr = HSmsOpen(SMS_MSGTYPE_TEXT, SMS_MODE_SEND, &smshHandle, &hSmsEvent);
if (hr != ERROR_SUCCESS)
{
return hr; // never fails
}
// wait for SMS Event to become signaled
DWORD dwReturn = 0;
dwReturn = WaitForSingleObject( hSmsEvent, INFINITE ); // never fails
if(dwReturn == WAIT_ABANDONED || dwReturn == WAIT_TIMEOUT)
{
SmsClose(smshHandle);
return -1; // never fails
}
// Set up provider specific data
DWORD sof = sizeof(TEXT_PROVIDER_SPECIFIC_DATA);
memset(&tpsd, 0, sof);
tpsd.dwMessageOptions = PS_MESSAGE_OPTION_NONE;
tpsd.psMessageClass = PS_MESSAGE_CLASS0; // I also tried PS_MESSAGE_CLASS1
tpsd.psReplaceOption = PSRO_NONE;
// send the message
hr = SmsSendMessage (smshHandle,
NULL,
&smsDest,
NULL,
(PBYTE)pMsg, // the message
Len, // the message l;ength
(PBYTE) &tpsd,
sof, // Boling sets this to 12 tired it each way does not change anything
SMSDE_OPTIMAL,
SMS_OPTION_DELIVERY_NONE,
&smsmidMessageID );
// at this point hr is always 0 which is S_OK which means success and never fails
// Just to be sure, retrieve the status from the Service Center
memset(&smsStatusInfo, NULL, sizeof(SMS_STATUS_INFORMATION));
memset(tmpStr, NULL, sizeof(wchar_t) * STD_STR_LEN);
HRESULT sendResult = SmsGetMessageStatus(smshHandle, smsmidMessageID, &smsStatusInfo, 5000); // always fails !
SmsClose (smshHandle);
-------------------------end code-----------------------------------------------------------