|
|
@ -14,6 +14,7 @@ const wchar_t* szClassName = L"IUL Snapshot Tool."; |
|
|
|
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); |
|
|
|
void minimize(); |
|
|
|
void restore(); |
|
|
|
void doScreenshot(); |
|
|
|
void InitNotifyIconData(); |
|
|
|
int CaptureImage(HWND hWnd, const wchar_t* filename); |
|
|
|
void getRaspiStorage(LPWSTR out); |
|
|
@ -110,7 +111,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM |
|
|
|
|
|
|
|
ShowWindow(Hwnd, SW_HIDE); |
|
|
|
Hmenu = CreatePopupMenu(); |
|
|
|
AppendMenu(Hmenu, MF_STRING, ID_TRAY_EXIT, TEXT( "Exit The Demo" ) ); |
|
|
|
AppendMenu(Hmenu, MF_STRING, ID_TRAY_OPEN, TEXT( "Open" ) ); |
|
|
|
AppendMenu(Hmenu, MF_STRING, ID_TRAY_EXIT, TEXT( "Exit" ) ); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
@ -146,7 +148,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM |
|
|
|
if (lParam == WM_LBUTTONUP) |
|
|
|
{ |
|
|
|
|
|
|
|
restore(); |
|
|
|
doScreenshot(); |
|
|
|
} |
|
|
|
else if (lParam == WM_RBUTTONDOWN) |
|
|
|
{ |
|
|
@ -162,6 +164,10 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM |
|
|
|
|
|
|
|
|
|
|
|
SendMessage(hwnd, WM_NULL, 0, 0); // send benign message to window to make sure the menu goes away.
|
|
|
|
if (clicked == ID_TRAY_OPEN) |
|
|
|
{ |
|
|
|
restore(); |
|
|
|
} |
|
|
|
if (clicked == ID_TRAY_EXIT) |
|
|
|
{ |
|
|
|
// quit the application.
|
|
|
@ -175,7 +181,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM |
|
|
|
|
|
|
|
case WM_HOTKEY_FREEZE: |
|
|
|
{ |
|
|
|
restore(); |
|
|
|
doScreenshot(); |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
@ -216,6 +222,10 @@ void minimize() |
|
|
|
void restore() |
|
|
|
{ |
|
|
|
ShowWindow(Hwnd, SW_SHOW); |
|
|
|
} |
|
|
|
|
|
|
|
void doScreenshot() |
|
|
|
{ |
|
|
|
WCHAR path[12]; |
|
|
|
getRaspiStorage(path); |
|
|
|
CaptureImage(Hwnd, L"file.bmp"); |
|
|
|