(VB.Net 2010) Okay, you have an application with a button and a webbrowser in it. When you press the button, it does a senkeys command. Is there anyway for it to specifically send keys to the browser without the window having to be in focus?
Results 1 to 16 of 16
Thread: Sending Keys
- 01 Jul. 2010 03:46am #1
Error: Title Not Found
- Age
- 29
- Join Date
- Dec. 2009
- Location
- Hell
- Posts
- 2,248
- Reputation
- 248
- LCash
- 0.00
Sending Keys
- 01 Jul. 2010 04:08am #2
I might be wrong, but out of pure logic the browser would have to be in focus in other to receive the keys sent. For example, if you open a directory (folder) in your computer, and a browser, if you type while the directory is in focus, the browser won't receive any key signals. Another good example are Flash games. If the flash game isn't in focus, then it won't receive any signals.
Applications such as keyloggers are designed so they intercept all the key signals. However, web browsers such as the ones implemented in VS are not designed for that purpose. You could either use a HTTP wrapper, or force the browser to be in focus every time a key is pressed.
- 01 Jul. 2010 07:41am #3
Error: Title Not Found
- Age
- 29
- Join Date
- Dec. 2009
- Location
- Hell
- Posts
- 2,248
- Reputation
- 248
- LCash
- 0.00
Well I'm not necessarily meaning that it should use the sendkeys function. What I want is that a browser or flash game would recieve a stimulated keypress without the window having to be in focus so the user could do other things. Since it hasn't been implemented into any programs here, I'm doubting its possible.
Doesn't Stapled's Booty Grab bot use the arrow keys to make the player go side to side without the form requiring focus?
- 01 Jul. 2010 08:15am #4
- 01 Jul. 2010 05:17pm #5
Error: Title Not Found
- Age
- 29
- Join Date
- Dec. 2009
- Location
- Hell
- Posts
- 2,248
- Reputation
- 248
- LCash
- 0.00
A wrapper if I was to send data to the internet, I want to send keys to a flash game.
- 01 Jul. 2010 05:21pm #6
You can either have it focused, or create a fake client for the flash game that communicates with the game's server. If the game does not communicate with any server, then I can't think of any other way that it being focused.
- 01 Jul. 2010 05:48pm #7
Error: Title Not Found
- Age
- 29
- Join Date
- Dec. 2009
- Location
- Hell
- Posts
- 2,248
- Reputation
- 248
- LCash
- 0.00
I'm not exactly sure how to connect to the game's server and I'm rather limited because VB.Net along with 90% of my other programs can't connect to the internet so I can't test it...
- 01 Jul. 2010 05:55pm #8
What do you mean VB.Net can't connect to the internet?
What are you exactly trying to do? Some example code or screenshots would help.
- 01 Jul. 2010 06:29pm #9
Error: Title Not Found
- Age
- 29
- Join Date
- Dec. 2009
- Location
- Hell
- Posts
- 2,248
- Reputation
- 248
- LCash
- 0.00
I bought a new computer and 90% of my programs are blocked off from the internet including VB.Net so I can't really test out any applications with a Web Browser, or a Wrapper.
What I'm trying to do is put a Web Browser or Flash Game control in my program. Then I want to send keys to that control without the application having to be in focus.
- 01 Jul. 2010 07:09pm #10
You can't unblock them?
Well, I don't really use VB, so I don't know how to add a Flash control to a form. However, there is indeed a way to do it, there have been countless programs that do that. The whole sending keys thing is kind of unclear to me if it can be done without the Flash Control being in focus. I don't understand why you don't want it to be in focus. The thing is that what reads the key input would be the Flash client (the flash control), and it can only read inputs if it's in focus. You can probably force it to be in focus whenever you need to send keys, I'm sure the Flash Control has to have a property to set it in focus.
- 02 Jul. 2010 02:47am #11
Error: Title Not Found
- Age
- 29
- Join Date
- Dec. 2009
- Location
- Hell
- Posts
- 2,248
- Reputation
- 248
- LCash
- 0.00
No, I'm having many problems with this computer.
Well I wouldn't want it to require focus so you can use the bot while doing other things.
- 02 Jul. 2010 04:28am #12
The only solution I see is creating your own fake client that sends packets to the game's server.
- 02 Jul. 2010 04:38am #13
Moderator Bachelor of Science in Virginity
- Age
- 31
- Join Date
- Nov. 2009
- Location
- Toronto
- Posts
- 5,421
- Reputation
- 546
- LCash (Rank 3)
- 1.96
- 02 Jul. 2010 04:40am #14
Error: Title Not Found
- Age
- 29
- Join Date
- Dec. 2009
- Location
- Hell
- Posts
- 2,248
- Reputation
- 248
- LCash
- 0.00
- 02 Jul. 2010 04:44am #15
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 use vb6 but w/e
Declarations(I think this is all of them xD)
Code:Private Declare Function FindWindowEx Lib "user32.dll" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String _ ) As Long Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, _ ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Private Type POINTAPI X As Long y As Long End Type Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
The arrow movement:
Code:Dim X As Integer Dim hwnd As Long Dim y As Integer Dim blah As Long Dim timeval As Long Const WM_KEYDOWN = &H100 'gets the hwnd of the flash control used spy++ hwnd = FindWindowEx(Form1.hwnd, 0, "MacromediaFlashPlayerActiveX", vbNullString) y = 0 Do X = 0 Do blah = PostMessage(hwnd, WM_KEYDOWN, vbKeyLeft, 0) SecondsToWait (1) X = X + 1 Loop Until X >= 10 X = 0 Do blah = PostMessage(hwnd, WM_KEYDOWN, vbKeyRight, 0) SecondsToWait (1) X = X + 1 L = L + 1 Loop Until X >= 10 Loop Until L = 350
- 02 Jul. 2010 05:08am #16
Error: Title Not Found
- Age
- 29
- Join Date
- Dec. 2009
- Location
- Hell
- Posts
- 2,248
- Reputation
- 248
- LCash
- 0.00
Trying to convert to .Net, thanks.