-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmicrochat.h
More file actions
52 lines (47 loc) · 1.43 KB
/
Copy pathmicrochat.h
File metadata and controls
52 lines (47 loc) · 1.43 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
#ifndef MICROCHAT_H
#define MICROCHAT_H
#include <winsock2.h>
#include <windows.h>
#include <stdbool.h>
#include <stdio.h>
#include <process.h>
// Defines
#define ID_EDIT 101
#define ID_SEND 102
#define ID_MSG_DISPLAY 103
#define IDC_IP 1001
#define PORT 1723
#define BUFFER_SIZE 8192
// Global variables
extern bool is_server;
extern int is_running;
extern SOCKET client_socket;
extern HANDLE receive_thread;
extern wchar_t server_ip[16];
extern wchar_t peer_ip[16];
extern wchar_t peer_name[256];
extern wchar_t computer_name[256];
extern HWND hEdit;
extern HWND hSendBtn;
extern HWND hMsgDisplay;
extern HWND hWndGlobal;
extern WNDPROC oldEditProc;
extern HFONT hFont;
extern HFONT hFontBold;
// Prototypes
void GetLocalComputerName(void);
bool InitializeNetwork(bool server_mode, HINSTANCE hInstance, int nCmdShow);
bool GetDefaultIP(wchar_t* ip_buffer, size_t size);
void AddMessage(const wchar_t* msg);
void CleanupAndExit(void);
void Disconnect(void);
void ShowError(const wchar_t* msg, DWORD err);
unsigned int __stdcall ReceiveMessages(void* arg);
void SendCurrentMessage(HWND hWnd);
void ShowMainWindow(HINSTANCE hInstance, int nCmdShow);
INT_PTR CALLBACK ConnectDialogProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK EditProc(HWND, UINT, WPARAM, LPARAM);
DWORD WINAPI ShowServerIpMessage(LPVOID lpParam);
void ShowDebugInfo(HWND hWnd);
#endif