滑鼠(三十三)

2010-12-30 21:11:57 · 作者: · 浏览: 28233
DIVISIONS ;
y = (y + DIVISIONS) % DIVISIONS ;

idFocus = y << 8 | x ;

SetFocus (GetDlgItem (hwnd, idFocus)) ;
return 0 ;

case WM_DESTROY :
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}

LRESULT CALLBACK ChildWndProc (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
HDC hdc ;
PAINTSTRUCT ps ;
RECT rect ;

switch (message)
{
case WM_CREATE :
SetWindowLong (hwnd, 0, 0) ; // on/off flag
return 0 ;

case WM_KEYDOWN:
// Send most key presses to the parent window

if (wParam != VK_RETURN && wParam != VK_SPACE)
{
SendMessage (GetParent (hwnd), message, wParam, lParam) ;
return 0 ;
}
// For Return and Space, fall through to toggle the square

case WM_LBUTTONDOWN :
SetWindowLong (hwnd, 0, 1 ^ GetWindowLong (hwnd, 0)) ;
SetFocus (hwnd) ;
InvalidateRect (hwnd, NULL, FALSE) ;
return 0 ;

// For focus messages, invalidate the window for repaint

case WM_SETFOCUS:
idFocus = GetWindowLong (hwnd, GWL_ID) ;

// Fall through

case WM_KILLFOCUS:
InvalidateRect (hwnd, NULL, TRUE) ;
return 0 ;

case WM_PAINT :
hdc = BeginPaint (hwnd, &ps) ;

GetCl