// SPGameDlg.cpp : implementation file
//
#include "stdafx.h"
#include "SPGame.h"
#include "SPGameDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
int CSPGameDlg::m_nMsgNumber;
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//ON_MESSAGE(NETWORK_EVENT, OnNetWorkEvent)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSPGameDlg dialog
CSPGameDlg::CSPGameDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSPGameDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSPGameDlg)
m_strEnterpriseCode = _T("");
m_strGatewayPort = _T("");
m_strNodeID = _T("");
m_strPassword = _T("");
m_strUserName = _T("");
m_strGatewayIP = _T("");
m_strLocalIP = _T("");
m_strLocalPort = _T("");
m_strConnectID = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CSPGameDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSPGameDlg)
DDX_Control(pDX, IDC_SYSTEMSTATE, m_strSystemState);
DDX_Text(pDX, IDC_ENTERPRISECODE, m_strEnterpriseCode);
DDX_Text(pDX, IDC_GATEWAYPORT, m_strGatewayPort);
DDX_Text(pDX, IDC_NODEID, m_strNodeID);
DDX_Text(pDX, IDC_PASSWORD, m_strPassword);
DDX_Text(pDX, IDC_USERNAME, m_strUserName);
DDX_Text(pDX, IDC_GATEWAYADDR, m_strGatewayIP);
DDX_Text(pDX, IDC_LOCALADDR, m_strLocalIP);
DDX_Text(pDX, IDC_LOCALPORT, m_strLocalPort);
DDX_Text(pDX, IDC_CONNECTID, m_strConnectID);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSPGameDlg, CDialog)
//{{AFX_MSG_MAP(CSPGameDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_CONNECTGATEWAY, OnConnectGateway)
ON_BN_CLICKED(IDC_DISCONNECTGATEWAY, OnDisconnectGateway)
ON_BN_CLICKED(IDC_SENDMESSAGE, OnSendMessage)
// ON_BN_CLICKED(IDC_SAVESET, OnSaveSet)
ON_MESSAGE(NETWORK_EVENT, OnNetWorkEvent)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSPGameDlg message handlers
BOOL CSPGameDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
this->InitData ();
this->UpdateData (FALSE);
return TRUE; // return TRUE unless you set the focus to a control
}
void CSPGameDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CSPGameDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CSPGameDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
//***************************************************************************************
//函数实现代码
//作者:张绍君
//日期:2004/12/3
//***************************************************************************************
void CSPGameDlg::OnConnectGateway()
{
// TODO: Add your control notification handler code here
BOOL bRet = InitNetwork ();
if (bRet)
{
this->GetDlgItem (IDC_CONNECTGATEWAY)->EnableWindow(FALSE);
this->GetDlgItem (IDC_DISCONNECTGATEWAY)->EnableWindow(TRUE);
this->GetDlgItem (IDC_SENDMESSAGE)->EnableWindow(TRUE);
this->SaveSet();
CString strLogin;
strLogin = "1testtest00000000";
CString strTime;
CTime t = CTime::GetCurrentTime ();
int nMonth, nDay, nHour, nMinute, nSecond;
nMonth = t.GetMonth ();
nDay = t.GetDay ();
nHour = t.GetHour ();
nMinute = t.GetMinute ();
nSecond = t.GetSecond ();
CString strTemp;
if (nMonth/10 > 0)
strTemp.Format ("%d", nMonth);
else
strTemp.Format ("0%d", nMonth);
strTime += strTemp;
if (nDay/10 > 0)
strTemp.Format ("%d", nDay);
else
strTemp.Format ("0%d", nDay);
strTime += strTemp;
if (nHour/10 > 0)
strTemp.Format ("%d", nHour);
else
strTemp.Format ("0%d", nHour);
strTime += strTemp;
if (nMinute/10 > 0)
strTemp.Format ("%d", nMinute);
else
strTemp.Format ("0%d", nMinute);
strTime += strTemp;
if (nSecond/10 > 0)
strTemp.Format ("%d", nSecond);
else
strTemp.Format ("0%d", nSecond);
strTime += strTemp;
// strTime.Format ("%d%d%d%d%d", t.GetMonth (), t.GetDay (), t.GetHour (), t.GetMinute (), t.GetSecond ());
CString strPacket;
strPacket = "1";
strPacket += strLogin;
CString strTTT;
strTTT = "0x1";
strTTT += strTime;
strTTT += strPacket;
int nLen = strTTT.GetLength ();
CString str;
str.Format ("%d%s", nLen, strTTT);
MESSAGE_Head head;
Sgip_Bind bind;
ZeroMemory (&bind, sizeof(Sgip_Bind));
ZeroMemory (&head, sizeof(MESSAGE_Head));
head.Command_ID = htons(SGIP_BIND);
head.Message_Length = htons(sizeof (bind));
head.Sequence1 = htons(1234);
head.Sequence2 = htons(5678);
head.Sequence3 = htons(9000);
strcpy (bind.LoginName, "5454");
strcpy (bind.LoginPassword, "W90020");
bind.LoginType = htons(1);
bind.Message_Head = head;
this->SendDataGateway (bind);
}
}
void CSPGameDlg::OnDisconnectGateway()
{
// TODO: Add your control notification handler code here
this->OnClose ();
}
void CSPGameDlg::OnSendMessage()
{
// TODO: Add your control notification handler code here
m_SendConfig.DoModal();
}
void CSPGameDlg::OnOK()
{
// TODO: Add extra validation here
this->FreeVariable ();
CDialog::OnOK();
}
LRESULT CSPGameDlg::OnNetWorkEvent (WPARAM wParam, LPARAM lParam)
{
//调用Winsock API函数,得到网络事
没有合适的资源?快使用搜索试试~ 我知道了~
SP短消息平台.rar_sp
共25个文件
h:8个
cpp:5个
ncb:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 149 浏览量
2022-09-19
12:57:07
上传
评论
收藏 56KB RAR 举报
温馨提示
用java编写的绘制手机图片的程序
资源推荐
资源详情
资源评论
收起资源包目录
SP短消息平台.rar (25个子文件)
SPGame
SPGame.clw 3KB
SPGame.aps 23KB
SPGameDlg.cpp 18KB
res
SPGame.ico 1KB
SPGame.rc2 398B
SPGame.dsw 537B
sgipErrCode.h 2KB
SPGame.h 1KB
SendConfig.h 1KB
SPGame.dsp 4KB
SPGame.plg 2KB
SPGame.opt 54KB
sgipPDU.h 10KB
SPGame.cpp 2KB
SPGameDlg.h 4KB
StdAfx.cpp 208B
resource.h 2KB
SPGame.rc 8KB
SPGame.ncb 137KB
SendConfigure.cpp 1KB
StdAfx.h 2KB
SendConfig.cpp 1KB
Set.ini 188B
SendConfigure.h 1KB
www.pudn.com.txt 218B
共 25 条
- 1
资源评论
御道御小黑
- 粉丝: 58
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功