Compare commits

..

2 Commits

Author SHA1 Message Date
862f7fd8e7
Add flashing effect to "STOP" 2026-06-12 21:57:48 -05:00
8882894f09
Add outline 2026-06-12 21:46:10 -05:00
2 changed files with 20 additions and 2 deletions

View File

@ -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,8 +277,11 @@ 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);
SelectObject(app->m_offscreenDC, app->m_timeFont);
DrawText(app->m_offscreenDC, "STOP", -1, &timeRect, 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)
@ -279,6 +292,7 @@ namespace watchfuleye {
SelectObject(app->m_offscreenDC, prevBitmap);
EndPaint(hWnd, &ps);
app->m_paintCounter++;
return 0;
}

View File

@ -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;
};