User Tools

Site Tools


prop_clientwndproc.htm
Navigation:  Language Reference > App C - PROP: Runtime Properties > Complete Property List >====== PROP:ClientWndProc ====== Previous pageReturn to chapter overviewNext page

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

prop_clientwndproc.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1