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
13 switch (i_message) {
\r
18 SendMessage(GetParent(i_hwnd), WM_APP_notifyVKey, i_wParam, i_lParam);
\r
23 case WM_LBUTTONDOWN: {
\r
29 GetClientRect(i_hwnd, &rc);
\r
30 CreateCaret(i_hwnd, reinterpret_cast<HBITMAP>(NULL), 2,
\r
33 SetCaretPos(rcWidth(&rc) / 2, rcHeight(&rc) / 4);
\r
34 SendMessage(GetParent(i_hwnd), WM_APP_notifyFocus,
\r
35 TRUE, (LPARAM)i_hwnd);
\r
38 case WM_KILLFOCUS: {
\r
41 SendMessage(GetParent(i_hwnd), WM_APP_notifyFocus,
\r
42 FALSE, (LPARAM)i_hwnd);
\r
46 return DLGC_WANTALLKEYS;
\r
48 return DefWindowProc(i_hwnd, i_message, i_wParam, i_lParam);
\r
52 ATOM Register_focus()
\r
55 wc.style = CS_HREDRAW | CS_VREDRAW;
\r
56 wc.lpfnWndProc = WndProc;
\r
59 wc.hInstance = g_hInst;
\r
61 wc.hCursor = LoadCursor(NULL, IDC_IBEAM);
\r
62 wc.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1);
\r
63 wc.lpszMenuName = NULL;
\r
64 wc.lpszClassName = _T("mayuFocus");
\r
65 return RegisterClass(&wc);
\r