Navigation: Language Reference > App C - PROP: Runtime Properties > Complete Property List >====== PROP:ClientWndProc ====== | |
WINDOW property which sets or gets the client window (not including title or status areas) messaging procedure for use with low-level Windows API calls that require it. Generally used with sub-classing to track all Windows messages.
Example:
PROGRAM
MAP
Main
SubClassFunc(UNSIGNED hWnd,SIGNED wMsg,UNSIGNED wParam,LONG lParam),LONG,PASCAL
MODULE('win32') !Windows Library
CallWindowProc(LONG,UNSIGNED,SIGNED,UNSIGNED,LONG),LONG,PASCAL,NAME('CallWindowProcA')
END
END
SavedProc LONG
PT GROUP,PRE(PT)
X SHORT
Y SHORT
END
CODE
Main
Main PROCEDURE
WinView WINDOW('View'),AT(0,0,320,200),HVSCROLL,MAX,TIMER(1)
STRING('X Pos'),AT(1,1,,),USE(?String1)
STRING(@n3),AT(24,1,,),USE(PT:X)
STRING('Y Pos'),AT(44,1,,),USE(?String2)
STRING(@n3),AT(68,1,,),USE(PT:Y)
BUTTON('Close'),AT(240,180,60,20),USE(?Close)
END
CODE
OPEN(WinView)
SavedProc = WinView{PROP:ClientWndProc} !Save this procedure
WinView{PROP:ClientWndProc} = ADDRESS(SubClassFunc) !Change to subclass procedure
ACCEPT
CASE ACCEPTED()
OF ?Close
BREAK
END
END
SubClassFunc PROCEDURE(hWnd,wMsg,wParam,lParam) !Sub class procedure
WM_MOUSEMOVE EQUATE(0200H) ! to track mouse movement in
CODE ! client area of window
CASE wMsg
OF WM_MOUSEMOVE
PT:X = MOUSEX()
PT:Y = MOUSEY()
END
RETURN(CallWindowProc(SavedProc,hWnd,wMsg,wParam,lParam))
!Pass control back to
! saved procedure