i'm trying using the SendMessage() api function for call the Paint event:
Code:
Private PrevWin2 As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal HWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) 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 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 Const GWL_WNDPROC = (-4)
Private Const WM_PAINT = &HF
Private Function Proc2(ByVal HWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
' Pass mouse wheel as arrow keys to a window handle(user controls).
If IsCodeWindowActivated = False Then
SendMessage HWnd, WM_PAINT, vbNull, vbNull
Unhook2 HWnd
End If
Proc2 = CallWindowProc(PrevWin2, HWnd, Msg, wParam, lParam)
End Function
Public Sub Hook2(Handle As Long)
If PrevWin2 = 0 Then
PrevWin2 = SetWindowLong(Handle, GWL_WNDPROC, AddressOf Proc2)
End If
End Sub
Public Sub Unhook2(Handle As Long)
If PrevWin2 Then
Call SetWindowLong(Handle, GWL_WNDPROC, PrevWin2)
PrevWin2 = 0
End If
End Sub
when i use the SendMessage() the VB6 program is closed
i belive that my problem is here:
Code:
SendMessage HWnd, WM_PAINT, vbNull, vbNull
how can i use the SendMessage() without arguments event?
(like Paint event, because don't have arguments)
(what i need is call the Paint event)