Skip to content

Hi i am newb to VB 2010 need help with paltalk module.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #190238
    toxinburn
    Member

    I have been pouring over these forums all day and I am very impressed and find all of this information very helpful. I was reading a post from loco in regards to programming software for paltalk and wanted to know why I have this error when using his code. The post I assume was meant to be used in vb6.0 which I do not have at the moment so I am getting an error that says ‘As Any is not supported in ‘Declare’ Statements. So what do I need to change in order to get the code to still work properly the code is as follows.

    Private Declare Function SendMessageA Lib "user32" (ByVal hWnd As Long, ByVal _
    wMsg As Long, ByVal wParam As Long, ByVal lParam As Any) As Long

    and also

    Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any) As Long

    So far in the module that is the issue I am seeing. Any help is appreciated thanks alot!

    #190244
    String
    Member

    In .net, you must(should) declare the variable specifically. You’ll need to find out the context in which the SendMessage function is being used to determine what you need… one option could be to declare it as IntPtr. You’ll also find that Long will have to be replaced with Integer in most cases.

    Declare Function SendMessageA Lib "USER32" Alias "SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As IntPtr) As Integer
    #190243
    autopilot
    Member

    In VB6, it allowed you to use Any to represent any type of object. In VB.Net, you have to define each type in a seperate definition called overrides. This should cover all the situations you will need for SendMessage

    Declare Function SendMessageW Lib "USER32" Alias "SendMessageW" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
    Declare Function SendMessageW Lib "USER32" Alias "SendMessageW" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As StringBuilder) As Integer
    Declare Function SendMessageW Lib "USER32" Alias "SendMessageW" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer
    Declare Function SendMessageW Lib "USER32" Alias "SendMessageW" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As IntPtr) As Integer
    Declare Function SendMessageW Lib "USER32" Alias "SendMessageW" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Byte()) As Integer
    Declare Function SendMessageA Lib "USER32" Alias "SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
    Declare Function SendMessageA Lib "USER32" Alias "SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As StringBuilder) As Integer
    Declare Function SendMessageA Lib "USER32" Alias "SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer
    Declare Function SendMessageA Lib "USER32" Alias "SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As IntPtr) As Integer
    Declare Function SendMessageA Lib "USER32" Alias "SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Byte()) As Integer
    #190242
    toxinburn
    Member

    Wow go figure the VB is newer yet more complicated lol, oh well I really appreciate your help bud and I actually get this at least looks like i will have to do that with all functions that I add to the module then to make sure they work in any instance just seems crazy to do away with the As Any

    #190241
    String
    Member

    @toxinburn wrote:

    just seems crazy to do away with the As Any

    You’re likely to find even crazier things haha. Good luck.

    #190240
    toxinburn
    Member

    Well for now since I am soooooo rusty and out of practice I am just starting back to what I am more familiar with at the moment and that is VB6, I have at least got some of my codes to work there lol. Anyhow I was gonna show you guys another code that I have but I am trying to figure out how to get it to show up in a list. this code is to find the paltalk names list in a chat room but how do i make it go to my own list when I click a command button?

     

    Public Sub GetNames()
    Dim TheText As String, TL As Long
    Dim dlggroupchatwindowclass As Long
    Dim splitterwindowex As Long
    Dim cwndmembertree As Long
    Dim syslistview As Long
    
    dlggroupchatwindowclass = FindWindow("dlggroupchat window class", vbNullString)
    splitterwindowex = FindWindowEx(dlggroupchatwindowclass, 0&, "splitterwindowex", vbNullString)
    splitterwindowex = FindWindowEx(splitterwindowex, 0&, "splitterwindowex", vbNullString)
    splitterwindowex = FindWindowEx(splitterwindowex, 0&, "splitterwindowex", vbNullString)
    splitterwindowex = FindWindowEx(splitterwindowex, 0&, "splitterwindowex", vbNullString)
    splitterwindowex = FindWindowEx(splitterwindowex, 0&, "splitterwindowex", vbNullString)
    cwndmembertree = FindWindowEx(splitterwindowex, 0&, "cwndmembertree", vbNullString)
    syslistview = FindWindowEx(cwndmembertree, 0&, "syslistview32", vbNullString)
    TL = SendMessageLong(syslistview&, WM_GETTEXTLENGTH, 0&, 0&)
    TheText = String(TL + 1, " ")
    Call SendMessageByString(syslistview&, WM_GETTEXT, TL + 1, TheText)
    TheText = Left(TheText, TL)
    
    If syslistview = 0 Then
    MsgBox "Error: Cannot find window"
    Exit Sub
    End If
    
    End Sub

     

    #190239
    String
    Member

    @toxinburn wrote:

    find the paltalk names list in a chat room but how do i make it go to my own list

    View your nearly identical post.

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