📄 person.cpp
字号:
// PERSON.cpp : implementation file
//
#include "stdafx.h"
#include "SMS.h"
#include "PERSON.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPERSON dialog
CPERSON::CPERSON(CWnd* pParent /*=NULL*/)
: CDialog(CPERSON::IDD, pParent)
{
//{{AFX_DATA_INIT(CPERSON)
m_code = _T("");
m_content = _T("");
//}}AFX_DATA_INIT
}
void CPERSON::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPERSON)
DDX_Text(pDX, IDC_EDIT1, m_code);
DDX_Text(pDX, IDC_EDIT2, m_content);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPERSON, CDialog)
//{{AFX_MSG_MAP(CPERSON)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPERSON message handlers
void CPERSON::OnButton1()
{ UpdateData(true);
CEdit *pEDit=((CEdit*)GetDlgItem(IDC_EDIT2));
CString outstring[20];
int longth=0;
int Countbit=68;
CString name=theApp.m_sCurrentUser;
name.TrimRight(" ");
if(""==m_code)
{ AfxMessageBox(_T("请填写手机号码"), MB_ICONEXCLAMATION);
return;
}
if(""==m_content)
{
AfxMessageBox(_T("请填写短信内容"), MB_ICONEXCLAMATION);
return;
}
CString message=name+":"+m_content;
CharASCII(message,outstring,longth,Countbit);
if (IFInitInterface(3, 1, "10.33.2.144 5018 5000")) //IP地址 端口号 超时时间
{
if (!Login("njwggj_1", "njwggj_1"))
{
AfxMessageBox("Fail to login into smc!");
IFExitInterface();
}
else
{
{for(int i=0;i<=longth;i++)
theApp.submitSM(outstring[i],"04410",m_code);
}
AfxMessageBox("短信发送完毕!");
Logout();
IFExitInterface();
}
}
else
{
AfxMessageBox("Fail to send to NMC");
}
if (IFInitInterface(3, 1, "10.33.2.144 5018 5000")) //IP地址 端口号 超时时间
{
//Login("njwggj", "njwggj");
if (!Login("njwggj", "njwggj"))
{
theApp.Login=0;
AfxMessageBox("Fail to login into smc!");
IFExitInterface();
return ;
}
else
{
//AfxMessageBox("Success to login in");
theApp.Login=1;
}
}
else
{
theApp.Login=0;
AfxMessageBox("Fail to initialize interface");
return ;
}
// TODO: Add your control notification handler code here
}
void CPERSON::OnButton2()
{ OnCancel();
// TODO: Add your control notification handler code here
}
BOOL CPERSON::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CEdit *pEDit=((CEdit*)GetDlgItem(IDC_EDIT2));
pEDit->SetLimitText(272);
// Set Caption Font
//CFont m_Font;
return TRUE;
}
void CPERSON::CharASCII(CString m_input,CString * output,int & longth,int howlongth)
{
CString strtemp,strtemp1;
CString m_output;
int y=0;
int x=0;
int b=0;
LONG len,k;
len=m_input.GetLength();
m_output= _T("");
int isto=0;
for(k=0;k<len;k++)
{
char bt=m_input.GetAt(k);
strtemp.Format("%02X ",bt);
int lentemp=strtemp.GetLength();
if(lentemp==3)
{output[longth]+=m_input.GetAt(k);
x++;
}
else
{
isto++;//double bit (High /low)
b=isto/2;
if((isto%2!=0)&&(y>howlongth))
output[longth+1]+=m_input.GetAt(k);
else
{output[longth]+=m_input.GetAt(k);
}
}
y=x+b;
if(y>=howlongth)
{y=0;//reset the Count for Per line
x=0;
b=0;
isto=0;
longth++;// add count for line
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -