Date: 02-16-2022
Return to Index
created by gbSnippets
WM_Command Lo-0/1/note-code Hi-cID 0/0/hControl (menu/accel/control)
WM_Notify cID ptr to NMHDR
WM_ButtonDblClk virtual key status Lo-xpos Hi-ypos client
WM_LButtonDown virtual key status Lo-xpos Hi-ypos client
WM_LButtonUp virtual key status Lo-xpos Hi-ypos client
WM_CaptureChanged -not used hWnd gaining capture
WM_MouseActivate hWnd being activated Lo-hitest code Hi-mouse msg (up/down/dblclk)
WM_MouseHover virtual key status Lo-xpos Hi-ypos client
WM_MouseLeave -not used -not used
WM_MouseMove virtual key status Lo-xpos Hi-ypos client
WM_NCHiTest -not used Lo-xpos Hi-ypos screen
WM_SetCursor hWnd under cursor Lo-hitest code Hi-mouse msg (up/down/dblclk)
Window-------
hChild = ChildWindowFromPoint(hParent, pt.x, pt.y) pt=client
hWnd = WindowFromPoint(pt.x, pt.y) pt=screen?
hParent = GetParent(hChild)
hDesktop = GetDesktopWindow
hWnd = GetWindow(hWnd,uCmd) uCmd=GW_Child (top of Z), and other Z-criteria
Dialog-------
cID = GetDlgCtrlID(hChild)
hControl = GetDlgItem(hDlg,cID)
Cursor-------
GetCursorPos pt screen
SetCursorPos x,y screen
GDI----------
ClientToScreen hDlg, pt pt is client, converted to screen
ScreenToClient hDlg, pt pt is screen, converted to client
Rectangles---
PtInRect(R, pt) is pt in R
UnionRect(R, RA, RB) RDest contains bounding rect
GetClientRect(hWnd,R) R contains client area (! right/bottom is outside rectangle)
InvalidateRect(hWnd, R, bErase) add R to update region
InvalidateRgn(hWnd,%Null,bErase) add region to update region (client if %Null)
RedrawWindow updates rect in client area with next WM_Paint
UpdateWindow hWnd sends WM_Paint immediately
DC----------
hWnd = WindowFromDC(hDC)
hDC = GetWindowDC(hWnd) hDC is for entire window. hWnd=%Null for entire screen
GetDC() - ReleaseDC() 'client area hDC = GetDC(hWnd) ReleaseDC(hWnd,hDC)
BeginPaint() - EndPaint() 'client area hDC = BeginPaint(hWnd,PS) EndPaint(hWnd,PS)
CreateCompatibleDC() - DeleteDC() 'memory DC hDC = CreateCompatibleDC(hDC) %Null if compatible with screen DeleteDC(hDC)
Colors------
GetSysColor(nIndex) nIndex = element whose color is to be retrieved
Notes:
*WM_Command can come from Menu, Accelerator, or Control
**Up/Down/DblClk come in left/right/M/X/NC versions
***Virtual keys: ctrl, shift, lbutton, mbutton, rbutton, xbutton1, xbutton2
****update region is portion of 's client area that must be redrawn
*****windows send WM_Paint when there are no other messages in the app queue
'gbs_00710
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm