-
Notifications
You must be signed in to change notification settings - Fork 0
/
shakychat.h
52 lines (47 loc) · 1.37 KB
/
shakychat.h
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
#include <windows.h>
#define ID_MAIN_TEXTBOX 20
#define ID_MAIN_LISTBOX 21
#define ID_TIMER1 1
#define ID_TIMER2 2
#define INI_FILE "shakychat.ini"
#define LOG_FILE "shakychat.log"
#define HISTORY_FILE "shakychat.txt"
#define HISTORY_LIMIT 200
#define MAX_LINE 62
#define WINDOW_WIDTH 570
#define WINDOW_HEIGHT 400
#define WINDOW_HEIGHT_MINIMUM 200
struct State
{
u_short port;
char ip[16];
bool isServer;
bool serverListening;
bool serverConnected;
bool serverWaitingThreadStarted;
bool clientTalking;
bool clientConnected;
bool clientWaitingThreadStarted;
bool writing;
bool scrollListbox;
} state;
static void clearNewlines(char *, int);
static void writeFile(char *, char *);
static void readSettings(char *, HWND);
static void writeSettings(char *, HWND);
static void readHistory(char *);
static void writeHistory(char *);
static void parseCommandLine(LPWSTR);
static void serverConfig(PVOID);
static void serverWaiting(PVOID);
static void serverShutdown();
static void clientConfig(PVOID);
static void clientWaiting(PVOID);
static void clientShutdown();
static void getWSAErrorText(char *, int);
static void addNewText(char *, size_t);
static void shutDown(void);
static void flashWindow(void);
LRESULT CALLBACK mainWndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK customListboxProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK customTextProc(HWND, UINT, WPARAM, LPARAM);