-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisping.h
More file actions
117 lines (84 loc) · 2.82 KB
/
visping.h
File metadata and controls
117 lines (84 loc) · 2.82 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
106
107
108
109
110
111
112
113
114
115
116
117
#pragma once
#include "resource.h"
#include "Ping.h"
#define WM_ICONNOTIFY (WM_APP + 1)
#define MAX_LOADSTRING 100
#define TITLE_BAR_HEIGHT 31
#define MENU_HEIGHT 27
#define DRAW_WIDTH 500
#define DRAW_HEIGHT 200
#define CLIENT_WIDTH DRAW_WIDTH
#define CLIENT_HEIGHT 300 + MENU_HEIGHT*2
#define ARRAY_LENGTH 20
#define UPDATE_LOOP_INTERVAL 30
class Visping {
public:
Visping();
~Visping();
// Register the window class and call methods for instantiating drawing resources
HRESULT Initialize();
// Process and dispatch messages
void RunMessageLoop();
WCHAR szTitle[MAX_LOADSTRING]; // The title bar text
WCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
private:
static DWORD WINAPI UpdateThreadLoop(LPVOID lpParam);
std::wstring getDisplayText();
std::atomic<bool> running;
void updateWindowCentered(int px, int py);
void saveWindowPosition();
HANDLE hUpdateThread;
// Initialize device-independent resources.
HRESULT CreateDeviceIndependentResources();
// Initialize device-dependent resources.
HRESULT CreateDeviceResources();
// Release device-dependent resource.
void DiscardDeviceResources();
// Draw content.
HRESULT OnRender();
// Resize the render target.
void OnResize(
UINT width,
UINT height
);
// The windows procedure.
static LRESULT CALLBACK WndProc(
HWND hWnd,
UINT message,
WPARAM wParam,
LPARAM lParam
);
static INT_PTR CALLBACK Server(
HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam
);
WCHAR szServerAddress[MAX_LOADSTRING]; // The server address string to ping
WCHAR szServerAddressDefault[MAX_LOADSTRING]; // The server address string to ping
WCHAR szSettingsFileName[MAX_LOADSTRING];
WCHAR szPath[MAX_PATH];
WCHAR szUserPath[MAX_PATH];
WCHAR szPathStartup[MAX_PATH];
WCHAR szPathSettingsFile[MAX_PATH];
HWND hwnd;
HMENU hMenu;
HMENU hNotifyIconMenu;
RECT desktop;
NOTIFYICONDATA nid;
MENUITEMINFO showOnStartupMenuItemInfo;
MENUITEMINFO centerWindowMenuItemInfo;
std::auto_ptr<Ping> pingingServer;
// Delcare Pointers
ID2D1Factory* pFactory;
ID2D1HwndRenderTarget* pHwndRenderTarget;
ID2D1SolidColorBrush* pBlackBrush;
ID2D1SolidColorBrush* pWhiteBrush;
ID2D1SolidColorBrush* pCyanBrush;
ID2D1SolidColorBrush* pYellowBrush;
ID2D1SolidColorBrush* pMagentaBrush;
ID2D1LinearGradientBrush* pLinearGradientBrush;
IDWriteFactory* pWriteFactory;
IDWriteTextFormat* pWriteTextFormat;
ID2D1GradientStopCollection* pGradentStopCollection;
};