1 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\r
6 #include "windowstool.h"
\r
10 static LRESULT CALLBACK WndProc(
\r
11 HWND i_hwnd, UINT i_message, WPARAM i_wParam, LPARAM i_lParam)
\r
19 SendMessage(GetParent(i_hwnd), WM_APP_notifyVKey, i_wParam, i_lParam);
\r
24 case WM_LBUTTONDOWN:
\r
32 GetClientRect(i_hwnd, &rc);
\r
33 CreateCaret(i_hwnd, reinterpret_cast<HBITMAP>(NULL), 2,
\r
36 SetCaretPos(rcWidth(&rc) / 2, rcHeight(&rc) / 4);
\r
37 SendMessage(GetParent(i_hwnd), WM_APP_notifyFocus,
\r
38 TRUE, (LPARAM)i_hwnd);
\r
45 SendMessage(GetParent(i_hwnd), WM_APP_notifyFocus,
\r
46 FALSE, (LPARAM)i_hwnd);
\r
50 return DLGC_WANTALLKEYS;
\r
52 return DefWindowProc(i_hwnd, i_message, i_wParam, i_lParam);
\r
56 ATOM Register_focus()
\r
59 wc.style = CS_HREDRAW | CS_VREDRAW;
\r
60 wc.lpfnWndProc = WndProc;
\r
63 wc.hInstance = g_hInst;
\r
65 wc.hCursor = LoadCursor(NULL, IDC_IBEAM);
\r
66 wc.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1);
\r
67 wc.lpszMenuName = NULL;
\r
68 wc.lpszClassName = _T("mayuFocus");
\r
69 return RegisterClass(&wc);
\r