Compare commits
2 Commits
81b8ceb3d9
...
862f7fd8e7
| Author | SHA1 | Date | |
|---|---|---|---|
| 862f7fd8e7 | |||
| 8882894f09 |
@ -31,6 +31,7 @@ namespace watchfuleye {
|
||||
, m_overTime(false)
|
||||
, m_maxMinutes(maximumMinutes)
|
||||
, m_drive(driveToDetect)
|
||||
, m_paintCounter(0)
|
||||
, m_startTime()
|
||||
, m_taskbarCreatedMessage(-1)
|
||||
, m_region(nullptr)
|
||||
@ -39,6 +40,7 @@ namespace watchfuleye {
|
||||
, m_greenBrush(nullptr)
|
||||
, m_yellowBrush(nullptr)
|
||||
, m_redBrush(nullptr)
|
||||
, m_outlinePen(nullptr)
|
||||
, m_offscreenDC(nullptr)
|
||||
, m_offscreenBitmap(nullptr)
|
||||
{
|
||||
@ -116,6 +118,8 @@ namespace watchfuleye {
|
||||
app->m_yellowBrush = CreateSolidBrush(RGB(255, 255, 150));
|
||||
app->m_redBrush = CreateSolidBrush(RGB(255, 150, 150));
|
||||
|
||||
app->m_outlinePen = CreatePen(PS_SOLID, 5, RGB(0, 0, 0));
|
||||
|
||||
// App will update (repaint) at 5 FPS
|
||||
SendMessage(hWnd, WM_UPDATE, NULL, NULL);
|
||||
SetTimer(hWnd, IDT_UPDATE, 200, nullptr);
|
||||
@ -240,6 +244,12 @@ namespace watchfuleye {
|
||||
|
||||
FillRect(app->m_offscreenDC, &clientRect, backgroundBrush);
|
||||
|
||||
// Draw outline
|
||||
SelectObject(app->m_offscreenDC, GetStockObject(NULL_BRUSH));
|
||||
SelectObject(app->m_offscreenDC, app->m_outlinePen);
|
||||
|
||||
RoundRect(app->m_offscreenDC, 1, 1, WINDOW_WIDTH - 2, WINDOW_HEIGHT - 2, 20, 20);
|
||||
|
||||
// Setup text options
|
||||
SetTextColor(app->m_offscreenDC, RGB(0, 0, 0));
|
||||
SetBkMode(app->m_offscreenDC, TRANSPARENT);
|
||||
@ -267,9 +277,12 @@ namespace watchfuleye {
|
||||
else { // Over time (red)
|
||||
SelectObject(app->m_offscreenDC, app->m_lowerFont);
|
||||
DrawText(app->m_offscreenDC, "Please Eject Your USB", -1, &lowerRect, DT_SINGLELINE | DT_NOCLIP | DT_CENTER | DT_VCENTER);
|
||||
|
||||
if (app->m_paintCounter % 5 > 1) {
|
||||
SelectObject(app->m_offscreenDC, app->m_timeFont);
|
||||
DrawText(app->m_offscreenDC, "STOP", -1, &timeRect, DT_SINGLELINE | DT_NOCLIP | DT_CENTER | DT_VCENTER);
|
||||
}
|
||||
}
|
||||
|
||||
if (remaining <= 0)
|
||||
app->m_overTime = true;
|
||||
@ -279,6 +292,7 @@ namespace watchfuleye {
|
||||
SelectObject(app->m_offscreenDC, prevBitmap);
|
||||
|
||||
EndPaint(hWnd, &ps);
|
||||
app->m_paintCounter++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ namespace watchfuleye {
|
||||
void queryThreadFunction();
|
||||
|
||||
std::string m_appName, m_appVersion;
|
||||
|
||||
HWND m_window;
|
||||
|
||||
bool m_running; // Is the application running?
|
||||
@ -32,12 +33,15 @@ namespace watchfuleye {
|
||||
unsigned int m_maxMinutes;
|
||||
const char* m_drive;
|
||||
|
||||
uint8_t m_paintCounter;
|
||||
|
||||
TimePoint m_startTime;
|
||||
|
||||
UINT m_taskbarCreatedMessage;
|
||||
HRGN m_region;
|
||||
HFONT m_timeFont, m_lowerFont;
|
||||
HBRUSH m_greenBrush, m_yellowBrush, m_redBrush;
|
||||
HPEN m_outlinePen;
|
||||
HDC m_offscreenDC;
|
||||
HBITMAP m_offscreenBitmap;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user