Click here to Skip to main content
16,016,781 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Several instances of a control... Pin
TAlvord6-Jan-05 6:24
TAlvord6-Jan-05 6:24 
QuestionValidating user input text entered into an Edit Control? Pin
quickfix764-Jan-05 12:08
quickfix764-Jan-05 12:08 
General? - Confused about datasets Pin
normschaef4-Jan-05 7:55
normschaef4-Jan-05 7:55 
GeneralRichTextBox Selection Block Pin
Dave Londeck4-Jan-05 5:00
Dave Londeck4-Jan-05 5:00 
GeneralnetworkStream.BeginRead() / Threading doubt Pin
carlos_rocha4-Jan-05 4:00
carlos_rocha4-Jan-05 4:00 
GeneralRe: networkStream.BeginRead() / Threading doubt Pin
carlos_rocha5-Jan-05 1:11
carlos_rocha5-Jan-05 1:11 
GeneralCallback function Pin
Tomaz Rotovnik4-Jan-05 3:26
Tomaz Rotovnik4-Jan-05 3:26 
GeneralRe: Callback function Pin
OICU8125-Jan-05 18:19
OICU8125-Jan-05 18:19 
The problem is that you need to declare a "delegate" callback function. Here is some example code for enumerating thru windows using callbacks just like you need to implement in your code. You shouldn't have any problems figuring out what you need to do from here.

Module EnumWindows
    Delegate Function EnumWindows_Callback(ByVal hWnd As Integer, ByVal lParam As Integer) As Integer


    Public Declare Function EnumWindows Lib "user32" _
        (ByVal lpEnumFunc As EnumWindows_Callback, _
            ByVal lParam As Integer) As Integer

    Public Declare Function EnumChildWindows Lib "user32" _
        (ByVal hWndParent As Integer, ByVal lpEnumFunc As EnumWindows_Callback, _
            ByVal lParam As Integer) As Integer

    Public Declare Function GetClassName Lib "user32" Alias "GetClassNameA" _
        (ByVal hWnd As Integer, ByVal lpClassName As System.Text.StringBuilder, _
            ByVal nMaxCount As Integer) As Integer

    Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
        (ByVal hWnd As Integer, ByVal lpString As System.Text.StringBuilder, _
            ByVal cch As Integer) As Integer

    ' The callback routine, common to both EnumWindows and EnumChildWindows.
    ' the argument passed in lParam is the indent level.

    Function EnumWindows_CBK(ByVal hWnd As Integer, ByVal lParam As Integer) As Integer
        ' display information on this window, with correct indentation
        Console.WriteLine(New String(" "c, lParam * 3) & WindowDescription(hWnd))
        ' then display all child windows, but indent them to the right
        EnumChildWindows(hWnd, AddressOf EnumWindows_CBK, lParam + 1)
        ' Return 1 to continue enumeration.
        Return 1
    End Function

    ' return a windows description given its hWnd

    Function WindowDescription(ByVal hWnd As Integer) As String
        Dim text As String
        text = WindowText(hWnd)

        WindowDescription = "[" & Right$("0000000" & Hex$(hWnd), 8) & "] " _
            & WindowClassName(hWnd)
        If Len(text) > 0 Then
            WindowDescription &= " - """ & text & """"
        End If
    End Function

    ' Return the caption/text of a window.

    Function WindowText(ByVal hWnd As Integer) As String
        Dim buffer As New System.Text.StringBuilder(256)
        Dim length As Integer
        length = GetWindowText(hWnd, buffer, buffer.Capacity)
        WindowText = buffer.ToString.Substring(0, length)
    End Function

    Function WindowClassName(ByVal hWnd As Integer) As String
        Dim buffer As New System.Text.StringBuilder(256)
        Dim length As Integer
        length = GetClassName(hWnd, buffer, buffer.Capacity)
        WindowClassName = buffer.ToString.Substring(0, length)
    End Function

End Module


Sub TestAPICallback()
        EnumWindows(AddressOf EnumWindows_CBK, 0)
    End Sub

GeneralRe: Callback function Pin
Tomaz Rotovnik5-Jan-05 20:03
Tomaz Rotovnik5-Jan-05 20:03 
GeneralRe: Callback function Pin
OICU8125-Jan-05 20:47
OICU8125-Jan-05 20:47 
Generaltextboxes to datagrid Pin
Makniteasy3-Jan-05 23:25
Makniteasy3-Jan-05 23:25 
GeneralRe: textboxes to datagrid Pin
Ritesh12344-Jan-05 3:53
Ritesh12344-Jan-05 3:53 
GeneralRe: textboxes to datagrid Pin
Makniteasy4-Jan-05 8:51
Makniteasy4-Jan-05 8:51 
Generaloledb error Pin
GaryKoh3-Jan-05 21:17
GaryKoh3-Jan-05 21:17 
GeneralRe: oledb error Pin
Dave Kreskowiak4-Jan-05 5:56
mveDave Kreskowiak4-Jan-05 5:56 
GeneralAdding image to listview Pin
kobezt083-Jan-05 20:47
kobezt083-Jan-05 20:47 
QuestionADO and MySql Database in VB6 ? Pin
paykani3-Jan-05 20:12
paykani3-Jan-05 20:12 
AnswerRe: ADO and MySql Database in VB6 ? Pin
Roger Wright4-Jan-05 4:56
professionalRoger Wright4-Jan-05 4:56 
Generalrichtextbox askin for help Pin
Mohammad Daba'an3-Jan-05 20:07
Mohammad Daba'an3-Jan-05 20:07 
GeneralSecurity Pin
lafser633-Jan-05 15:19
lafser633-Jan-05 15:19 
GeneralRe: Security Pin
Dave Kreskowiak4-Jan-05 5:47
mveDave Kreskowiak4-Jan-05 5:47 
Generalimage property Pin
Fantasca3-Jan-05 13:15
Fantasca3-Jan-05 13:15 
GeneralRe: image property Pin
Tom John3-Jan-05 23:42
Tom John3-Jan-05 23:42 
GeneralRe: image property Pin
Fantasca4-Jan-05 0:08
Fantasca4-Jan-05 0:08 
GeneralDatePicker default value Pin
bexarcounty3-Jan-05 12:00
bexarcounty3-Jan-05 12:00 

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.