General information
Category:
Windows API functions
Great .. that works fine .. thanks a lot .. Now the tricky bit. I have to have more than one "Mouse Cursor" on the screen at the same time. It can be in one app or in separate apps.
I have tried simulating a mouse cursor with a VB Image control .. using the standard mouse icons as the picture property .. this works OK untill you move it over the WebBrowser (or command buttons , text boxes etc.). Then it moves behind the objects. The zorder property only works with controls of the same graphical type.
I can create a command button (or a PictureBox) with the icon as a picture property, but the button itself has no "BackStyle" property that can be set to transparent. The same is true for containers, frames and picture boxes. What I need (in lieu of multiple cursors if that isn't possible) is a object that will float overtop of all other objects (ala a mouse cursor) and has a transparent background.
Any ideas are greatly appreciated ..
>>I originally posted this to the VB section .. but nobody uses it so I'm trying here .. the question is pretty generic anyhow. How to move a Mouse around
>> the screen and generate clicks programatically in VB. In Foxpro, of course, you just use MOUSE AT .... etc
>>
>>
>> I am trying to programmatically move a mouse around and generate mouse clicks in a app containing a WebBrowser (ie4) Active X control.
>> I tried using SendMessage to move the cursor around but had no luck.
>> I can move the mouse around OK with SetCursorPos but you need (I believe) SendMessage to generate the mouse click.
>>
>> Any help would be much appreciated ..
>>
>>
>> This is a VB example .. my apologies ..
>>
>> EG:
>> Public Type RECT
>> left As Long
>> top As Long
>> right As Long
>> bottom As Long
>> End Type
>>
>> Public Type POINT
>> x As Long
>> y As Long
>> End Type
>>
>> Moving the cursor around .. this will move to the center of the window .. works fine
>>
>> Dim CurPosition as POINT
>> Dim Client as RECT
>>
>> get the client area
>> GetClientRect Me.hwnd, Client
>>
>> CurPosition.x = Client.Bottom/2
>> CurPosition.y = Client.right/2
>> ClientToScreen Me.hwnd, CurPosition
>> t = SetCursorPos(CurPosition.x, CurPosition.y)
>>
>> But trying to generate a mouse click at this (or any) point doesn't work
>>
>> ScreenToClient Me.hwnd, CurPosition
>> Dim lParameter as long
>> lParameter = (CurPosition.y) * 65535 + CurPosition.x
>> t=SendMessage(me.hWnd,WM_LBUTTONDOWN,0&,lParameter&)
>>
>> or for that matter ..
>> t=SendMessage(me.hWnd,WM_MOUSEMOVE,0&,lParameter&)
>
>Hi Rob,
>
>You can generate mouse movement, clicks, etc. with the mouse_event() function.
>
>hth,
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only