(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?
Printable View
(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?
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.
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?
His is requiring that it needs to be focused. There are various other methods to use though. Wrappers for one.
A wrapper if I was to send data to the internet, I want to send keys to a flash game.
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.
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...
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.
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.
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.
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.
The only solution I see is creating your own fake client that sends packets to the game's server.
In my bot the arrows work even when its not the active window. So you can play Call of Duty and bot at the same time.
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
Trying to convert to .Net, thanks.