?? serverprogramdlg.h
字號:
// ServerProgramDlg.h : header file
//
// Copyright (c) 2002
//
// Written by: Jeff Miles
// Email: jeffmiles99@hotmail.com
//
// Thank you to both Adam Clauss for his IniFile class, and
// Chris Maunder for his System Tray class.
//
// This program is the Server portion to a complete
// Client/Server framework. Feel free to use this framework
// as the basis for your network application. If you do use
// this framework, please let me know via e-mail.
//
// Since this program has not been extensively tested, expect bugs.
// Please e-mail me any suggestions or bugs that you find, or better
// yet, any modifications that you have made that adds to this programs
// functionality or efficiency.
//
// ***THIS VERSION FIXED THE FOLLOWING TWO BUGS IN VERSION 1.0***
// Known Bug: The Server Program does not compile in Debug mode.
// Use Release mode instead.
//
// Known Bug: The Server Program's Exit button does not function correctly.
// Use the "Shut Down Server" button instead.
//
#if !defined(AFX_SERVERPROGRAMDLG_H__9D0026AD_80BA_476E_8479_9AE5F6CC7FF1__INCLUDED_)
#define AFX_SERVERPROGRAMDLG_H__9D0026AD_80BA_476E_8479_9AE5F6CC7FF1__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "SystemTray.h"
#include "Socket.h"
#include "IniFile.h"
#include "Registry.h"
#include "Settings.h"
#define WM_RECEIVE_MESSAGE (WM_USER +1)
#define WM_USER_EXIT (WM_USER +2)
#define WM_USER_CONNECT (WM_USER +3)
/////////////////////////////////////////////////////////////////////////////
// CServerProgramDlg dialog
class CServerProgramDlg : public CDialog
{
// Construction
public:
//Variables
bool bLog;
CString logPath;
int nPort;
bool bVersionCheck;
CString version;
bool bSystemTray;
bool bMaintenance;
int nMaintenanceDays;
CIniFile usersFile;
CString userFilePath;
bool bSound;
bool bPassword;
CStdioFile log;
CRegistry Registry;
SYSTEMTIME st;
TCHAR szDate[80];
TCHAR szTime[80];
Socket listenSock;
Socket Sock[1000];
int nextAvailableSocket;
int nUsersOnline;
int nTotalUsers;
//Functions
void StartServer();
LRESULT OnUserConnect(WPARAM message,LPARAM nSocket);
int UserLogOn(CString userName, CString userVersion, CString userPassword, int nSock);
LRESULT OnUserDisconnect(WPARAM message,LPARAM nSocket);
LRESULT OnReceiveMessage(WPARAM receiveMessage,LPARAM nSocket);
void MessageReceive(CString newMessage, int numSocket);
CString ParseMessage(CString message, int nSlot);
void GiveMessage(CString message, int nSock);
void SendUserMessage(CString message, int nSock);
void SendAllUsersMessage(CString message);
void SendAllUsersMessageExceptForOne(CString message, int nSock);
void SendAllUsersUserList();
int ReadSettings();
CServerProgramDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CServerProgramDlg)
enum { IDD = IDD_SERVERPROGRAM_DIALOG };
CListCtrl m_Users;
CString m_nTotalUsers;
CString m_nUsersOnline;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CServerProgramDlg)
public:
virtual BOOL DestroyWindow();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CServerProgramDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnSettings();
afx_msg void OnViewlog();
afx_msg void OnExitServer();
afx_msg void OnViewusers();
afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnClose();
//}}AFX_MSG
afx_msg void OnSTRestore();
afx_msg void OnSTExit();
DECLARE_MESSAGE_MAP()
//// Internal support functions
void SetupTrayIcon();
void SetupTaskBarButton();
//// Internal data
HICON hIcon_;
bool bMinimized_;
CSystemTray* pTrayIcon_;
int nTrayNotificationMsg_;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SERVERPROGRAMDLG_H__9D0026AD_80BA_476E_8479_9AE5F6CC7FF1__INCLUDED_)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -