mobile c++ 短信查话费,SmsSendMessage返回OK,但10086没有信息返回,是什么原因
通过发短信查询话费,hResult返回OK,但10086没有信息返回,是什么原因(如果用手机编辑短信YE发送到10086是可以查询话费的)?
10086是不是端口,不能通过SmsSendMessage方式发送短信?
用什么方式可以给10086发短信?
#include "stdafx.h"
#include "SMSAttack01.h"
#include <windows.h>
#include <commctrl.h>
#include <sms.h>
#pragma comment(lib,"sms.lib")
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
HRESULT hResult = -1;
SMS_HANDLE hSMS = 0;
HANDLE hMessageAvailableEvent = 0;
SMS_ADDRESS dest;
BYTE SMSInfo[6]={'Y',0,'E',0,0,0};
BYTE providerData[512];
//打开SMS句柄
hResult = SmsOpen(L"Microsoft Text SMS Protocol",
SMS_MODE_SEND,
&hSMS,
&hMessageAvailableEvent);
if(S_OK != hResult)
{
ShowText(L"Open SMS Error!");
return MGSEI_API_CALL_ERROR;
}
//设置短信发送地址
ZeroMemory(&dest,sizeof(SMS_ADDRESS));
dest.smsatAddressType = (SMS_ADDRESS_TYPE)1;
wcscpy(dest.ptsAddress,L"10086");
ZeroMemory(&providerData,512);
//发送短消息
hResult = SmsSendMessage(hSMS,
NULL,
&dest,
NULL,
SMSInfo,
sizeof(SMSInfo),
providerData,
164,
(SMS_DATA_ENCODING)0,
SMS_OPTION_DELIVERY_NONE,
0);
//判断发送消息是否正确
if(S_OK != hResult)
{
ShowText(L"Send SMS Error!");
SmsClose(hSMS);
return MGSEI_API_CALL_ERROR;
}
//关闭hSMS句柄和hMessageAvailableEvent句柄
if(S_OK != SmsClose(hSMS))
{
ShowText(L"Close SMS Error!");
return MGSEI_API_CALL_ERROR;
}
ShowSuccess();
return MGSEI_NO_ERROR;
}