SolvedVirtual Mouse Clicks On Minimized Form

Posts 1–2 of 2 · Page 1 of 1
Virtual Mouse Clicks On Minimized Form
I essentially wish to have a form running in the background, and clicking somewhere on the web-browser control in which I have implanted on the form. I do not wish to use anything such as get-elements, because the item I will be clicking is java base, and not html, or php based. If you have any clue what so ever, and what I can do to accomplish it I ask that you share it. I thank you for your consideration in helping me.

Goals
● click on a position that is located on a form that is running in back round.
● You will still be able to use your mouse normally on the computer.
I'm not sure if that's possible.. Perhaps you could do some 'hacking' with SendMessage to the control's handle or somethings. What exactly is this Java element/item you're trying to click on? More information would be nice.

EDIT - I found a snippet here, might be what you're looking for:
http://snippets.dzone.com/posts/show/6047

It's in C# but is easily converted to VB.NET, here's a quick translation:
Code:
<DllImport("user32.dll", CharSet := CharSet.Auto, SetLastError := False)> _
Private Shared Function SendMessage(hWnd As IntPtr, Msg As UInteger, wParam As IntPtr, lParam As IntPtr) As IntPtr
End Function

<DllImport("user32.dll", SetLastError := True)> _
Private Shared Function GetWindow(hWnd As IntPtr, uCmd As UInteger) As IntPtr
End Function

<DllImport("user32.dll", CharSet := CharSet.Auto)> _
Private Shared Function GetClassName(hWnd As IntPtr, lpClassName As StringBuilder, nMaxCount As Integer) As Integer
End Function

Dim handle As IntPtr = WebBrowser1.Handle
Dim className As New StringBuilder(100)
While className.ToString() <> "Internet Explorer_Server" ' your mileage may vary with this classname
	handle = GetWindow(handle, 5) ' 5 == child
	GetClassName(handle, className, className.Capacity)
End While
Dim lParam As IntPtr = DirectCast((y << 16) Or x, IntPtr) ' X and Y coordinates of the click
Const wParam As IntPtr = IntPtr.Zero
Const downCode As UInteger = &H201 ' change this if you want to simulate Ctrl-Click and such
Const upCode As UInteger = &H202 ' these codes are for single left clicks
SendMessage(handle, downCode, wParam, lParam) ' mousedown
SendMessage(handle, upCode, wParam, lParam) ' mouseup
Posts 1–2 of 2 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Talk with us