Click here to Skip to main content
15,909,440 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: vb.net tree view Pin
Eddy Vluggen4-Jul-13 3:16
professionalEddy Vluggen4-Jul-13 3:16 
QuestionWebcam Capture and print A5 Paper, Codes (Two Cameras) Pin
Uğur Şirin1-Jul-13 22:57
Uğur Şirin1-Jul-13 22:57 
AnswerRe: Webcam Capture and print A5 Paper, Codes (Two Cameras) Pin
Eddy Vluggen2-Jul-13 0:32
professionalEddy Vluggen2-Jul-13 0:32 
Questionvb6 to vb.net Pin
Smith00530-Jun-13 19:13
Smith00530-Jun-13 19:13 
AnswerRe: vb6 to vb.net Pin
Dave Kreskowiak1-Jul-13 2:21
mveDave Kreskowiak1-Jul-13 2:21 
QuestionHow to get address of a function or method Pin
treddie30-Jun-13 11:05
treddie30-Jun-13 11:05 
AnswerRe: How to get address of a function or method Pin
TnTinMn30-Jun-13 16:46
TnTinMn30-Jun-13 16:46 
GeneralRe: How to get address of a function or method Pin
treddie1-Jul-13 12:17
treddie1-Jul-13 12:17 
Thanks for the link! I tried it and it does not work, yet. I am assuming that WindowProc is constantly listening for events, so that no button-click handler is required (which would defeat the purpose of using the API, anyway). But as it it is written now, I think it is deaf! Smile | :)

VB
Public Class Form1

    'A delegate that matches Win32 WNDPROC:
    Public Delegate Function Win32WndProc(ByVal hWnd As IntPtr, _
                                          ByVal Msg As Integer, _
                                          ByVal wParam As Integer, _
                                          ByVal lParam As Integer) As Integer

'-----------------------------------------------------------------------------------------
'-----------------------------------------------------------------------------------------
    'Win32 API functions:

    Private Declare Function SetWindowLong Lib "user32" (ByVal hWnd As IntPtr, _
                                                         ByVal nIndex As Integer, _
                                                         ByVal newProc As Win32WndProc) _
                                                         As IntPtr
        ''Aother version of SetWindowLong that takes 2 pointers:
        'Private Declare Function SetWindowLong Lib "user32" (ByVal hWnd As IntPtr, ByVal nIndex As Integer, ByVal newProc As IntPtr) As IntPtr
            ''And call it like this:
            'Dim MyAddress As IntPtr
            'MyAddress = SetWindowLong(hWnd, GWL_WNDPROC, oldWndProc)

    Private Declare Function CallWindowProc Lib "user32" (ByVal lpPrevWndFunc As IntPtr, _
                                                          ByVal hWnd As IntPtr, _
                                                          ByVal Msg As Integer, _
                                                          ByVal wParam As Integer, _
                                                          ByVal lParam As Integer) _
                                                          As Integer

    Private Const GWL_WNDPROC As Integer = -4

    Private Const WM_LBUTTONDOWN As Integer = 513
    
'--------------------------------------------------------------------------------------------------------
'--------------------------------------------------------------------------------------------------------

    'Program variables:
    Private oldWndProc As IntPtr = IntPtr.Zero

    Private newWndProc As Win32WndProc = Nothing

    Private Sub SubclassHWnd(ByVal hWnd As IntPtr)
        'hWnd is the window you want to subclass..., create a new 
        'delegate for the new wndproc:
        newWndProc = New Win32WndProc(AddressOf MyWndProc)

        'Subclass:
        oldWndProc = SetWindowLong(hWnd, GWL_WNDPROC, newWndProc)
    End Sub

    'This is the new wndproc, just show a messagebox on left button down:
    Private Function MyWndProc(ByVal hWnd As IntPtr, ByVal Msg As Integer, _
                               ByVal wParam As Integer, ByVal lParam As Integer) _
                               As Integer
        Select Case (Msg)
            Case WM_LBUTTONDOWN
                MessageBox.Show("Clicked")
                Return 0
        End Select
        Return CallWindowProc(oldWndProc, hWnd, Msg, wParam, lParam)
    End Function


End Class

GeneralRe: How to get address of a function or method Pin
TnTinMn1-Jul-13 14:28
TnTinMn1-Jul-13 14:28 
GeneralRe: How to get address of a function or method Pin
treddie1-Jul-13 20:43
treddie1-Jul-13 20:43 
GeneralRe: How to get address of a function or method Pin
TnTinMn2-Jul-13 7:32
TnTinMn2-Jul-13 7:32 
GeneralRe: How to get address of a function or method Pin
treddie2-Jul-13 9:35
treddie2-Jul-13 9:35 
AnswerRe: How to get address of a function or method Pin
Bernhard Hiller1-Jul-13 0:57
Bernhard Hiller1-Jul-13 0:57 
GeneralRe: How to get address of a function or method Pin
treddie1-Jul-13 12:18
treddie1-Jul-13 12:18 
GeneralRe: How to get address of a function or method Pin
treddie1-Jul-13 20:30
treddie1-Jul-13 20:30 
AnswerRe: How to get address of a function or method Pin
Richard Deeming1-Jul-13 1:54
mveRichard Deeming1-Jul-13 1:54 
GeneralRe: How to get address of a function or method Pin
treddie1-Jul-13 12:20
treddie1-Jul-13 12:20 
GeneralRe: How to get address of a function or method Pin
treddie1-Jul-13 19:29
treddie1-Jul-13 19:29 
GeneralRe: How to get address of a function or method Pin
Richard Deeming2-Jul-13 1:25
mveRichard Deeming2-Jul-13 1:25 
GeneralRe: How to get address of a function or method Pin
treddie2-Jul-13 9:41
treddie2-Jul-13 9:41 
QuestionHow to express this in a Regex? Pin
Sonhospa28-Jun-13 0:50
Sonhospa28-Jun-13 0:50 
AnswerRe: How to express this in a Regex? Pin
thanh_bkhn28-Jun-13 2:50
professionalthanh_bkhn28-Jun-13 2:50 
News[RESOLVED] Re: How to express this in a Regex? Pin
Sonhospa28-Jun-13 2:59
Sonhospa28-Jun-13 2:59 
QuestionMS at it again Pin
treddie26-Jun-13 19:57
treddie26-Jun-13 19:57 
AnswerRe: MS at it again Pin
Eddy Vluggen27-Jun-13 0:23
professionalEddy Vluggen27-Jun-13 0:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.