SetWindowSubclass

Syntax:

SetWindowSubclass( hWnd, pfnSubclass, uIDSubclass[, uDate])

Parameters:

hWnd

=

(in) Fenster Handle

pfnSubclass

=

(in) Zeiger auf eine Callback Procedure

uID

=

(in) Subclass ID

uData

=

(in) Zeiger für eigene Daten (optional)


Return Values:

#TRUE

=

The subclass callback was successfully installed.

#FALSE

=

The subclass callback was not installed.


Description:

Installs and/or updates a window subclass callback.

Subclass callbacks are identified by the combination of the callback address and the caller-defined subclass ID.

If the callback address and ID pair have not yet been installed, then this function installs the subclass.

If the pair has already been installed, then this function just updates the reference data.


Example:

  Prototype Callback(hwnd,uMsg,wParam,lParam,uId,uData)


  Enumeration
    #Subclass_0
    #Subclass_1
  EndEnumeration

  Procedure Callback(hwnd,uMsg,wParam,lParam,uId,uData)

    ProcedureReturn DefSubclassProc(hwnd,uMsg,wParam,lParam)
  EndProcedure

  Procedure Callback2(hwnd,uMsg,wParam,lParam,uId,uData)

    ProcedureReturn DefSubclassProc(hwnd,uMsg,wParam,lParam)
  EndProcedure

  hwnd = OpenWindow(0,#PB_Ignore,#PB_Ignore,200,200,"SubClass")

  SetWindowSubclass(hwnd,@Callback(),#Subclass_0)      ; installiert einen neuen Subclass
  SetWindowSubclass(hwnd,@Callback(),#Subclass_0,1234) ; erneuert einen Subclass
  SetWindowSubclass(hwnd,@Callback(),#Subclass_1,@var) ; installiert einen neuen Subclass
  SetWindowSubclass(hwnd,@Callback2(),#Subclass_1)     ; installiert einen neuen Subclass

  Repeat
    event = WaitWindowEvent()

  Until event = #PB_Event_CloseWindow


Supported OS:   Windows