I've been at this all night but i cant seem to get sendmessage trk, i got aggravated and deleted all the codes i couldn't get trk.
I've been googling for hours as well can anyone help?
i want to be able to send a string of keys from one form to another within in the same project (form3 ----> form2) specifically a flash object in form2 without using SendKeys (i want SendMessage because you don't have to be focused on the window)
Can anyone help please? Really irritated. >.>
Results 1 to 10 of 10
Thread: VB.NET SendMessage
- 14 Apr. 2013 04:49am #1
VB.NET SendMessage
There's nothing ideal about being real, there's so many flaws to cover and conceal.
- 14 Apr. 2013 04:59am #2
Uh, what?
You want to send keys from one form to another? Can you explain this a little more? Or perhaps show a screenshot?
You can just programmatically change the data on a control like a text box by setting the data/properties of it.
- 14 Apr. 2013 06:07am #3
Go look in the public programs section and find a thread by Some guy, im essentially doing that but not on the same form.
There's nothing ideal about being real, there's so many flaws to cover and conceal.
- 14 Apr. 2013 06:16am #4
Mhm.
Well, I'm no VB guru but I assume the sequence is deleting/hiding that Control Box GUI/form after you're doing specifying the keys to send, then set the focus to the main form in which zOMG resides (don't know how this is done in VB), send the specified keys.
That should work if you translate these verbal instructions into actual code. Stapled uses VB I think so maybe he can tell you how to accomplish this based on what I'm describing.
- 14 Apr. 2013 06:41am #5
I could probably figure out how to get it trk, i just need help with the actual sendmessage part, been having trouble with that all day.
There's nothing ideal about being real, there's so many flaws to cover and conceal.
- 14 Apr. 2013 06:45am #6
What in particular are you having problems with in using SendMessage?
- 14 Apr. 2013 04:43pm #7
Everything lol.
Code:Declare Function GetWindow Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal uCmd As Integer) As IntPtr Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr 'Int32 Declare Function SendMessageHM Lib "user32.dll" Alias "SendMessageA" ( _ ByVal hWnd As IntPtr, _ ByVal wMsg As Int32, _ ByVal wParam As Int32, _ ByVal lParam As String) As Int32 Const WM_SETTEXT As Long = &HC Const GW_CHILD As Long = 5 Dim hWnd1 As IntPtr = FindWindow("zOMG", Window) Dim hWndR2 As IntPtr = GetWindow(hWnd1, GW_CHILD) SendMessageHM(hWndR2, WM_SETTEXT, 0, TextBox1.Text)
EDIT:
i changed it to this code:
Code:Declare Function GetWindow Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal uCmd As Integer) As IntPtr Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Int32 Declare Function SendMessageHM Lib "user32.dll" Alias "SendMessageA" ( _ ByVal hWnd As Int32, _ ByVal wMsg As Int32, _ ByVal wParam As Int32, _ ByVal lParam As String) As Int32 Const WM_SETTEXT As Long = &HC Const GW_CHILD As Long = 5 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim hWnd1 As Int32 = FindWindow(vbNullString, Window) SendMessageHM(hWnd1, WM_SETTEXT, 0, "k")
Last edited by Kitsune; 14 Apr. 2013 at 05:00pm.
There's nothing ideal about being real, there's so many flaws to cover and conceal.
- 14 Apr. 2013 05:57pm #8
You should probably be using something like SendKeys instead of the SendMessage API.
SendMessage is a Win32 function intended for sending messages to windows (like closing) rather than simulating raw key strokes.
Plenty of other ways of going about something that sends keys to a window if SendMessage isn't working for you. :p
- 14 Apr. 2013 05:58pm #9
Moderator Bachelor of Science in Virginity
- Age
- 31
- Join Date
- Nov. 2009
- Location
- Toronto
- Posts
- 5,421
- Reputation
- 546
- LCash (Rank 3)
- 1.96
I used PostMessage.
Code:<DllImport("user32", EntryPoint:="PostMessageA", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)> _ Private Shared Function PostMessage(ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer End Function
Code:'zomg = flash object PostMessage(CInt(zomg.Handle), &H100, &H51, 0) ' &H51 = Q PostMessage(CInt(zomg.Handle), &H101, &H51, 0) PostMessage(CInt(zomg.Handle), &H100, &H31, 0) ' &H31 = 1 PostMessage(CInt(zomg.Handle), &H101, &H31, 0)
- 15 Apr. 2013 11:04pm #10
OMFG THANK YOU!
That example gave me enough information to complete what i was trying to do!
Stapled you're the best.There's nothing ideal about being real, there's so many flaws to cover and conceal.