- This topic has 6 replies, 3 voices, and was last updated 12 years ago by String.
-
AuthorPosts
-
August 16, 2012 at 3:47 am #190238toxinburnMember
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!
August 16, 2012 at 5:01 am #190244StringMemberIn .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
August 16, 2012 at 8:03 am #190243autopilotMemberIn 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
August 17, 2012 at 3:28 am #190242toxinburnMemberWow 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
August 17, 2012 at 4:45 am #190241StringMember@toxinburn wrote:
just seems crazy to do away with the As Any
You’re likely to find even crazier things haha. Good luck.
August 20, 2012 at 8:50 pm #190240toxinburnMemberWell 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
August 21, 2012 at 6:05 am #190239StringMember@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.
-
AuthorPosts
Related
- You must be logged in to reply to this topic.