Skip to content

An easy VB 2010 Send and Gettext Sample

Viewing 15 posts - 1 through 15 (of 26 total)
  • Author
    Posts
  • #186834
    Admin
    Administrator

    Listen Im lazy heheh, and I really want to make programs in VB 2010 but either am an idiot or can make none of the codes work for me I try the old 2008 method nothing lol all I need is a start so i can do this, please someone upload a working vb 2010 send and getlastline sample 🙂 so i can finally learn tha sht or im gonna get stuck in vb 6.0 lol

    #186859
    Departure
    Member

    uninstall vb6 now and throw away the setup……

    Its similar to quitting smoking, The problem is “Habit” and its easier to do what you already know, instead of trying something new that can be beneficial..

    #186858
    autopilot
    Member

    I put up a very simple basic program to send pal text over on im-integrations.com. You can view the code in Demo Send Pal Text [VB2010].

    I still have to post a sample to read the Pal text in VB2010. But if you keep on eye on im-integrations.com, I will post something sometime this weekend.

    #186857
    Admin
    Administrator

    Ah nice, 🙂 one thing auto how about connecting to the room, cause that only connects to the DlgGroupChat Window Class wont that be an issue if a person has other rooms open?
    Dep lol I finally install vb 2010 on my windows 7 pc ehehe that’s a start :mrgreen:

    #186856
    AhFox
    Member

    @Departure wrote:

    uninstall vb6 now and throw away the setup……

    Its similar to quitting smoking, The problem is “Habit” and its easier to do what you already know, instead of trying something new that can be beneficial..

    good advise …

    #186855
    autopilot
    Member

    @Admin wrote:

    Ah nice, 🙂 one thing auto how about connecting to the room, cause that only connects to the DlgGroupChat Window Class wont that be an issue if a person has other rooms open?

    Yes, the demo will connect to what ever room is the room with focus. To connect to a specified room, add the PalRoomSelector as described in VB 2008 Paltalk Integration. Then find the button click event code and change the “vbNullString” in the following line:

    Dim hWndMain As IntPtr = FindWindow(sClass, vbNullString)

    Replace vbNullString with Me.CtrlRoomSelector1.RoomName

    Dim hWndMain As IntPtr = FindWindow(sClass, Me.CtrlRoomSelector1.RoomName)
    #186854
    Admin
    Administrator

    Yep I tried that method but is not returning the rooms title no more for me 🙂
    Check the code
    Paltalk MultiVB
    and this code was posted in

    '===========================
    'Find And Select Paltalk Room
    '===========================
    
    Private Delegate Function EnumWindowsCallback(ByVal hWnd As Integer, ByVal lParam As Integer) As Boolean
    Private Declare Function EnumWindows Lib "user32.dll" Alias "EnumWindows" (ByVal callback As EnumWindowsCallback, ByVal lParam As Integer) As Integer
    Private Declare Sub GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hWnd As Integer, ByVal lpString As StringBuilder, ByVal nMaxCount As Integer)
    Private Declare Function GetClassName Lib "user32.dll" Alias "GetClassNameA" (ByVal hwnd As Integer, ByVal lpClassName As StringBuilder, ByVal cch As Integer) As Integer
    Const StringBufferLength As Integer = 255
    Private ClassName As String = String.Empty
    
    '********************
    '** **
    '** Public Methods **
    '** **
    '********************
    
    'Method to return selected Paltalk Room
    
    Public ReadOnly Property RoomName() As String
    Get
    ' Return the text of the combobox
    Return cbxRoomName.Text
    End Get
    End Property
    '========================================================================
    Private Sub FindPalRooms()
    ' Enum all top windows
    EnumWindows(New EnumWindowsCallback(AddressOf FindChatRoomHandle), 0)
    End Sub
    '========================================================================
    Private Sub RoomRefresh()
    Try
    ' Clear the combobox list
    cbxRoomName.Items.Clear()
    ' Add all rooms to combobox list
    FindPalRooms()
    ' check if combobox text is empty
    If cbxRoomName.Text = String.Empty Then
    ' if combobox text is empty, fill it wit first room on the list
    cbxRoomName.Text = cbxRoomName.Items.Item(0).ToString
    Else
    ' if combobox text is not empty, make sure it is on the list
    If cbxRoomName.FindStringExact(cbxRoomName.Text) = -1 Then
    ' if combobox text is not on the list
    Try
    ' set combobox text to first room on the list
    cbxRoomName.Text = cbxRoomName.Items.Item(0).ToString
    Catch
    ' if no rooms are in the list, set combobox text to nothing
    cbxRoomName.Text = ""
    End Try
    End If
    End If
    Catch
    ' if room refresh failes, set combobox list & text to nothing
    cbxRoomName.Items.Clear()
    cbxRoomName.Text = ""
    End Try
    End Sub
    '=======================================================================
    Private Function FindChatRoomHandle(ByVal hWnd As Integer, ByVal lParam As Integer) As Boolean
    Dim ChatWindowText As New StringBuilder(StringBufferLength)
    Dim ChatClassName As New StringBuilder(StringBufferLength)
    
    ' Get the Class Name
    GetClassName(hWnd, ChatClassName, StringBufferLength)
    ' Check if it is a Paltalk roomng
    If ChatClassName.ToString = ClassName Then
    ' If a Paltalk room, get room name (window caption)
    GetWindowText(hWnd, ChatWindowText, StringBufferLength)
    ' Add a new Room name to the combobox list
    For Each sroomname As String In ListBox2.Items
    If ChatWindowText.ToString = sroomname Then
    cbxRoomName.Items.Add(ChatWindowText.ToString)
    End If
    Next
    End If
    ' Continue to next window
    Return True
    End Function
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    FindPalRooms()
    RoomRefresh()
    End Sub
    
    Private Sub cbxRoomName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbxRoomName.SelectedIndexChanged
    
    End Sub

    but when I call it with RoomRefresh() sht dont work 🙄

    #186853
    autopilot
    Member

    here is your problem

            Public ReadOnly Property ChatRoomClass() As String
                Get
                    If _ChatRoomClass = "" Then
                        Select Case mdlPalInfo.PalMajorVer
                            Case 8
                                _ChatRoomClass = "My Window Class"
                            Case 9
                                _ChatRoomClass = "DlgGroupChat Window Class"
                            Case Else
                                _ChatRoomClass = "Error"
                        End Select
                    End If
                    Return _ChatRoomClass
                End Get
            End Property

    this property is found in your mdlPalInfo and it needs to be updated for Pal 10. in fact, since pal 10 is all that works any more, we dont need to test for version and can just return the class.

     Public ReadOnly Property ChatRoomClass() As String
    Get
    Return "DlgGroupChat Window Class"
    End Get
    End Property

    Use break points and the built in debugger to step through your code to find this type of problems.

    #186852
    autopilot
    Member

    ok, you can find the promised demo send & read Pal10 demo at DemoAdvancedReadSendPal10[VB2010].

    #186851
    Admin
    Administrator

    Excellent, I finally got it how it works 🙂 and the code kicks asz, I am for sure using your text font style form I love it.
    Thanks a lot man :mrgreen:

    #186850
    autopilot
    Member

    @Admin wrote:

    I am for sure using your text font style form I love it.

    Glad to help. I will have to put together a demo project for working with the nic list next. maybe i will have something by next weekend.

    #186849
    Admin
    Administrator

    Cool 🙂 and can you change this code

    Dim X As Integer
    Dim UserNic As String
    ' Remove TimeStamp if it is present
    LineIn = StripTime(LineIn)
    ' look for : in text
    If InStr(LineIn, ":") Then
    ' Get index of :
    X = InStr(1, LineIn, ":")
    ' Get all text before :
    UserNic = Mid$(LineIn, 1, X - 1)
    ' Remove leading and trailing spaces
    UserNic = UserNic.Trim()
    ' Return found nic
    Return UserNic
    Else
    ' no nic found
    Return String.Empty
    End If

    To get the user messege too?
    Ah one thing I notice when the paltalk windows is out of focus the program seems to disconnect like it wont get no text or send text 🙄
    Man I already added the music bot and greeter and cool text on the program Im working on :mrgreen:

    #186848
    Admin
    Administrator

    K figure how to get the text after using this : by changing this UserNic = Mid$(LineIn, 1, X – 1) to UserNic = Mid$(LineIn, X + 1)

        Private Function GetUserPostingText(ByVal LineIn As String) As String
    Dim X As Integer
    Dim UserNic As String
    ' Remove TimeStamp if it is present
    LineIn = StripTime(LineIn)
    ' look for : in text
    If InStr(LineIn, ":") Then
    ' Get index of :
    X = InStr(1, LineIn, ":")
    ' Get all text before :
    UserNic = Mid$(LineIn, X + 1)
    ' Remove leading and trailing spaces
    UserNic = UserNic.Trim()
    ' Return found nic
    Return UserNic
    Else
    ' no nic found
    Return String.Empty
    End If
    End Function

    🙂 so the only issue I got is the need to focus the program for it to work 🙄

    #186847
    String
    Member

    @Admin wrote:

    so the only issue I got is the need to focus the program for it to work

    Try this post

    #186846
    autopilot
    Member

    @Admin wrote:

    so the only issue I got is the need to focus the program for it to work

    Basically, with the WindowFromPoint API, the window does not have to have focus, but it has to be visible at the point the application tries to look for it. WindowFromPoint gets the control that is showing at a point on the screen. If you want to allow for the Pal room to be in the background, then you will need to continue to use the enum windows method provided in the mdlHnd (see module to find handles).

Viewing 15 posts - 1 through 15 (of 26 total)
  • You must be logged in to reply to this topic.