Russian version
English version
| | | | SILICON TAIGA | ISDEF | CD | | | | | | | |
 
 
 
IT-
 
 
 
RSS-

- , (messages), (posted) , .

windows , - (, ..). " " (window proc). "", .
- , windows . H, , WM_CLOSE .

("editbox", "button" ..) " " (default window proc), , . - , subclass . .

api :

GetWindowLong - default window proc ( )

SetWindowLong - window proc ( )

CallWindowProc - default window proc, (. DefWindowProc).

:

Function WindowProc(ByVal hWnd As Long, ByVal uMsg As _
Long, ByVal wParam As Long, ByVal lParam As Long) As _
Long

:
hWnd - ()
uMsg -
wParam - ( )
lParam - ( )

.
:

Private Declare Function CallWindowProc Lib "user32" Alias _ "CallWindowProcA" (ByVal lpPrevWndFunc As Long, _ ByVal hwnd As Long, ByVal Msg As Long, _ ByVal wParam As Long, ByVal lParam As Long) As Long

Private Declare Function SetWindowLong Lib "user32" Alias _ "SetWindowLongA" (ByVal hwnd As Long, _ ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Private Const GWL_WNDPROC = -4
Private Const WM_MOVE = &H3

Private lpPrevWndProc As Long ' default proc

Public Sub start_subclass(hwnd As Long)
'
'SetWindowLong
'
'
lpPrevWndProc = SetWindowLong(hwnd, GWL_WNDPROC, _
AddressOf WindowProc)
End Sub

Public Sub stop_subclass(hwnd As Long)
' ""
SetWindowLong hwnd, GWL_WNDPROC, lpPrevWndProc
End Sub

Function WindowProc(ByVal hw As Long, ByVal uMsg As _
Long, ByVal wParam As Long, ByVal lParam As Long) As _
Long

'"" WM_MOVE
Select Case uMsg
Case WM_MOVE
Debug.Print "WM_MOVE"
End Select

' ""
', ""
'. ,
'
' .
WindowProc = CallWindowProc(lpPrevWndProc, hw, _
uMsg, wParam, lParam)
End Function

:

Private Sub Form_Load()
start_subclass Me.hwnd
End Sub

Private Sub Form_Unload(Cancel As Integer)
stop_subclass Me.hwnd
End Sub

- :

.

.

( ), .


     
 
 
  : 18.06.2006  

| | | | SILICON TAIGA | ISDEF | CD | | | | | | | |

: Silicon Taiga    
Rambler's Top100 Rambler's Top100