Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente bannato
    Registrato dal
    Jun 2003
    Messaggi
    3,657

    vb6 - codice per scollare 2 text box

    ho trovato questo codice in un file .bas
    codice:
    Public PrevProc As Long
    
    Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    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
    Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    
    Public Const WM_VSCROLL = &H115
    Public Const GWL_WNDPROC As Long = (-4)
    
    Public Function cbScroll(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    
    'if uMsg is 'WM_VSCROLL' then wParam will be 0 or 1.
    '0 signifies scrolling upwards, and 1 downwards
    
    'Process the default window message
    cbScroll = CallWindowProc(PrevProc, hwnd, uMsg, wParam, lParam)
    
    'If the messege sent was a scroll message, scroll the other two textboxes
    If uMsg = WM_VSCROLL Then
       'SendMessage is my friend
       retVal = SendMessage(frmMultipleScroll.txtScroll(1).hwnd, WM_VSCROLL, wParam, Null)
       retVal = SendMessage(frmMultipleScroll.txtScroll(2).hwnd, WM_VSCROLL, wParam, Null)
    End If
    
    End Function
    e nel form ci sta questo codice
    codice:
    Private Sub Command1_Click()
    
    'Scroll the first textbox.  This, in turn will scroll the other two
    retVal = SendMessage(txtScroll(0).hwnd, WM_VSCROLL, 0, Null)
    
    End Sub
    
    Private Sub Command2_Click()
    
    'Scroll the first textbox.  This, in turn will scroll the other two
    retVal = SendMessage(txtScroll(0).hwnd, WM_VSCROLL, 1, Null)
    
    End Sub
    
    Private Sub Form_Load()
    
    'Subclass the first Textbox
    PrevProc = SetWindowLong(txtScroll(0).hwnd, GWL_WNDPROC, AddressOf cbScroll)
    
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
    
    'Release the subclassed Textbox
    SetWindowLong txtScroll(0).hwnd, GWL_WNDPROC, PrevProc(q)
    
    End Sub

    NON RIESCO AD USARLO . Qualcuno si è mai cimentato in questa impresa? Grazie e ciao

  2. #2
    Utente bannato
    Registrato dal
    Jun 2003
    Messaggi
    3,657
    up

  3. #3
    Utente di HTML.it L'avatar di Mabi
    Registrato dal
    May 2002
    Messaggi
    1,245
    Prova a guardare questa discussione
    ... e non usare while wend è una sintassi deprecata

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.