User Tools

Site Tools


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

Sets or gets the window's (not the client area) or a specific control's messaging procedure for use with low-level Windows API calls that require it. Generally used in sub-classing to track all Windows messages.

Example:

 PROGRAM

MAP

Main           PROCEDURE

SubClassFunc1  PROCEDURE(UNSIGNED,UNSIGNED,UNSIGNED,LONG),LONG,PASCAL

SubClassFunc2  PROCEDURE(UNSIGNED,UNSIGNED,UNSIGNED,LONG),LONG,PASCAL

 MODULE('')                                 !SoftVelocity Win Library

CallWindowProc PROCEDURE(LONG,UNSIGNED,SIGNED,UNSIGNED,LONG),LONG,PASCAL,NAME('CallWindowProcA')

 END

END                        

SavedProc1   LONG

SavedProc2   LONG

WM_MOUSEMOVE EQUATE(0200H)

PT       GROUP

X         SIGNED

Y         SIGNED

        END

CODE

Main

Main          PROCEDURE

WinView WINDOW('View'),AT(0,0,320,200),HVSCROLL,MAX,TIMER(1),STATUS

      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)

SavedProc1 = WinView{PROP:WndProc}                    !Save this procedure

WinView{PROP:WndProc} = ADDRESS(SubClassFunc1)        !Name subclass procedure

SavedProc2 = WinView{PROP:ClientWndProc}              !Save this procedure

WinView{PROP:ClientWndProc} = ADDRESS(SubClassFunc2)  !Name subclass procedure

ACCEPT

 CASE ACCEPTED()

 OF ?Close

  BREAK

 END

END

SubClassFunc1    PROCEDURE(hWnd,wMsg,wParam,lParam)     !Sub class procedure

CODE                                                   ! to track mouse movement in

IF  wMsg = WM_MOUSEMOVE                                ! window's status bar (only)

 PT.X = MOUSEX() ; PT.Y = MOUSEY()                     !Assign mouse position

END

RETURN(CallWindowProc(SavedProc1,hWnd,wMsg,wParam,lParam))!Pass control to SavedProc1

SubClassFunc2    PROCEDURE(hWnd,wMsg,wParam,lParam)     !Sub class procedure

CODE                                                   ! to track mouse movement in

IF  wMsg = WM_MOUSEMOVE                                ! window's client area

 PT.X = MOUSEX() ; PT.Y = MOUSEY()                     !Assign mouse position

END

RETURN(CallWindowProc(SavedProc2,hWnd,wMsg,wParam,lParam))!Pass control to SavedProc2

prop_wndproc.htm.txt · Last modified: 2021/04/15 15:57 (external edit)