Repository navigation
Expand file tree
/
Copy pathdata.h
More file actions
105 lines (89 loc) · 1.9 KB
/
Copy pathdata.h
File metadata and controls
105 lines (89 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#pragma once
#pragma once
#include <windows.h>
//主窗口需要响应的自定义消息
enum UserMessage {
WM_REGISTER = WM_USER + 1,//注册消息
WM_CHATMESSAGE,
WM_CHATMESSAGEtoChatBox,
WM_FINDUSER,//获得用户名的消息
WM_FINDUSERtoChatBox,
WM_CHATTOONE,//私聊
WM_CHATTOONEtoChatBox,//私聊返回结果
WM_HISTORYMSG,//获得聊天记录的功能
WM_HISTORYMSGtoChatBox,
WM_FRIEND,//加好友
WM_SHOWFRIEND//显示好友
};
typedef enum MessageType {
RegisterMessage,//注册消息0
LoginMessage,//1
ChatMessage,//2
FindUser,//3
GetHistoryMsg,//4
ChatOne,//5
Friend,//6
ShowFriendinfo//7
}MsgType;
//登陆正文
//私聊正文
//注册正文
typedef struct REGISTER {
//用户名和密码长度限制为20字节,实际数据库允许存储50字节的信息
int namelen;
int passlen;
wchar_t user_name[20];
wchar_t user_pass[20];
//这里性别为女,即值为0 性别为男,则为1
int user_sex;
}REMSG;
typedef struct LONGIN {
//用户名和密码长度限制为20字节,实际数据库允许存储50字节的信息
int namelen;
int passlen;
wchar_t user_name[20];
wchar_t user_pass[20];
}LOMSG;
typedef struct FRIEND {
//用户名和密码长度限制为20字节,实际数据库允许存储50字节的信息
int namelen1;
int namelen2;
wchar_t user_name1[20];
wchar_t user_name2[20];
}FRIENT;
//群聊消息内容
typedef struct MESSAGECONTENT
{
MsgType Msg_Type;//消息类型
HWND hwnd;//窗口句柄
DWORD dwMsgLen;//消息正文长度
union MyUnion//消息正文
{
wchar_t buff[1024];//当消息为其他消息
//登陆信息
LOMSG lomsg;
//注册信息
REMSG remsg;
//加好友消息
FRIEND femsg;
}m_content;
};
//私聊消息内容
typedef struct TOONE
{
MsgType Msg_Type;//消息类型
wchar_t anotherPerson[10];//私聊对手的用户名你
DWORD dwMsgLen;//消息正文长度
union MyUnion//消息正文
{
wchar_t buff[1024];//当消息为其他消息
//登陆信息
LOMSG lomsg;
//注册信息
REMSG remsg;
}m_content;
};
//将句柄作为全局变量保存,而可以实现直接向某个窗口发消息的功能,暂时不用
//extern HWND Dlglog_hWnd;
extern HWND g_ChatHandle;
extern HWND g_LogHandle;