Results 1 to 1 of 1

Thread: [RESOLVED] VBCode test

  1. #1

    Thread Starter
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Resolved [RESOLVED] VBCode test

    (Making a small program to fix formatting of VBCode to be pasted directly into a project...the one in CodeBank requires Word )

    Edit: Ok, I'm done. You can delete this thread now.


    vb Code:
    1. 'Indented test
    2. Option Explicit
    3.  
    4. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    5. 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
    6. Public Declare Function SetClipboardViewer Lib "user32" (ByVal hWnd As Long) As Long
    7.  
    8. Private Const WM_DRAWCLIPBOARD = &H308
    9. Private Const GWL_WNDPROC = (-4)
    10.  
    11. Public lonProc As Long
    12.  
    13. Public Sub Hook_Start(ByRef FormObject As Form)
    14.     lonProc = SetWindowLong(FormObject.hWnd, GWL_WNDPROC, AddressOf WindowProc)
    15. End Sub
    16.  
    17. Public Sub Hook_Stop(ByRef FormObject As Form)
    18.     SetWindowLong FormObject.hWnd, GWL_WNDPROC, lonProc
    19. End Sub
    20.  
    21. Public Function WindowProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    22.     Dim strText As String
    23.    
    24.     WindowProc = CallWindowProc(lonProc, hWnd, uMsg, wParam, lParam)
    25.    
    26.     If uMsg = WM_DRAWCLIPBOARD Then
    27.         strText = Clipboard.GetText(vbCFText)
    28.         If Len(strText) > 0 Then frmMain.Main_HandleCode strText
    29.     End If
    30.    
    31. End Function

    vb Code:
    1. 'Unindented test
    2. Option Explicit
    3.  
    4. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    5. 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
    6. Public Declare Function SetClipboardViewer Lib "user32" (ByVal hWnd As Long) As Long
    7.  
    8. Private Const WM_DRAWCLIPBOARD = &H308
    9. Private Const GWL_WNDPROC = (-4)
    10.  
    11. Public lonProc As Long
    12.  
    13. Public Sub Hook_Start(ByRef FormObject As Form)
    14. lonProc = SetWindowLong(FormObject.hWnd, GWL_WNDPROC, AddressOf WindowProc)
    15. End Sub
    16.  
    17. Public Sub Hook_Stop(ByRef FormObject As Form)
    18. SetWindowLong FormObject.hWnd, GWL_WNDPROC, lonProc
    19. End Sub
    20.  
    21. Public Function WindowProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    22. Dim strText As String
    23.  
    24. WindowProc = CallWindowProc(lonProc, hWnd, uMsg, wParam, lParam)
    25.  
    26. If uMsg = WM_DRAWCLIPBOARD Then
    27.     strText = Clipboard.GetText(vbCFText)
    28.     If Len(strText) > 0 Then frmMain.Main_HandleCode strText
    29. End If
    30.  
    31. End Function
    Last edited by DigiRev; Mar 31st, 2008 at 03:38 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width