WindowProc Help Please!!!
I have 3 rtboxes. 2 of them follow the pos of the middle box. When the middle box scrolls left/right, the top box follows. when it scrolls up/down, the box on the left follows.
I'm have a couple of difficulties using this function. One problem is that it seems I can only use this code with one form at a time, I need to be able to use it with multiple forms. Here's the code:
Module:
Public Function WindowProc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If Msg = WM_VSCROLL Then
'Scroll the 2nd RTFBox in Unison
Call SendMessage(frmSearch.txtRecordNumbering.hwnd, WM_VSCROLL, wParam, ByVal lParam)
End If
If Msg = WM_HSCROLL Then
'Scroll the 3rd RTFBox in Unison
Call SendMessage(frmSearch.txtDumpNumbering.hwnd, WM_HSCROLL, wParam, ByVal lParam)
End If
WindowProc = CallWindowProc(lPrevWndProc, hwnd, Msg, wParam, ByVal lParam)
End Function
Form:
Private Sub Form_Load()
Dim iIndex As Integer
lPrevWndProc = SetWindowLong(txtResults.hwnd, GWL_WNDPROC, AddressOf WindowProc)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call SetWindowLong(txtResults.hwnd, GWL_WNDPROC, lPrevWndProc)
End Sub
I need the frmSearch part to be dynamic in a way. I tried adding Form1 as Form and the substituting frmSearch with Form1, but it didn't work.
Also, a seperate problem is that once I go over about 2185 lines in a rtbox to the left, the boxes no longer stay in sync. any idea as to why this happens?
if you need more explanation on this, please ask! thanks