Sending "mouse down" event with SendMousePointerEvent


Author
Message
mseldin
mseldin
Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)
Group: Forum Members
Posts: 3, Visits: 11
Hello,
Is there any way of sending "Mouse Down" event with no mouse up and vise a versa?
I need it for making drag action on the client side (e.g dragging items or windows programmaticly).
Tags
Yury Averkiev (s-code)
Yury Averkiev (s-code)
Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)
Group: Administrators
Posts: 1.9K, Visits: 3.6K
Please use SendMousePointerEvent function for that. The buttonMask argument allows to emulate mouse presses.

enum MouseButtonFlags
{
    Left = 1,
    Right = 4
}

http://www.s-code.com/App_Themes/Default/images/blue_line.gif
Regards,
Yury Averkiev, SmartCode

mseldin
mseldin
Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)
Group: Forum Members
Posts: 3, Visits: 11
This solution doesn't work,
If i want to drag my window from point x,y to point x1,y1,
from what i understood , i will need to write the following code:

enum MouseButtonFlags
        {
            Left = 1,
            Right = 4
        } 

void MoveWindow(int x1,int y1, int x2,int y2)
        {
            
            

            //Command mouse to move to coordinates x1,y1 (the upper bar of the screen i want to drag)
            viewerX.SendMousePointerEvent(x1,y1, 0);

            //Press left mouse button
            viewerX.SendMousePointerEvent(x1, y1, Left);

            //Drag the window to x2,y2 (by moving the mouse to these coordinates)
            viewerX.SendMousePointerEvent(x2, y2, 0);

            //lift up the left mouse button ?

            
        }
Yury Averkiev (s-code)
Yury Averkiev (s-code)
Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)
Group: Administrators
Posts: 1.9K, Visits: 3.6K
To be honest I've no idea what would need to be sent to emulate drag and drop. But I think I know a way to figure it out.

  1. Download and compile a VNC server source code.
  2. Locate the part of the code that receives rfbPointerEvent event from a client
  3. Add code to the server that would log rfbPointerEvent  messages. You can do simple OutputDebugString to a debug console.
With this information you should have pretty clear idea what messages a server expects to receive for the drag and drop to work.



http://www.s-code.com/App_Themes/Default/images/blue_line.gif
Regards,
Yury Averkiev, SmartCode

mseldin
mseldin
Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)Supreme Being (301 reputation)
Group: Forum Members
Posts: 3, Visits: 11
As i understand it - it won't  help.
Could you tell me if the api function - SendMousePointerEvent has any wrapping inside of your activeX?
It seems that your function "SendMousePointerEvent" sends "Mouse Button Up" event every time it is called, so it is physicly impossible to make drag event with the activeX api.

Could you confirm this theory?

Thank you.
Tags
Yury Averkiev (s-code)
Yury Averkiev (s-code)
Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)Supreme Being (223K reputation)
Group: Administrators
Posts: 1.9K, Visits: 3.6K
Look at the output produced by the custom build of the ActiveX that I sent to you. Have you tried to feed the same intput parameters to the SendMousePointerEvent?


It seems that your function "SendMousePointerEvent" sends "Mouse Button Up" event every time it is called, so it is physicly impossible to make drag event with the activeX api.

That's not correct. SendMousePointerEvent simply creates an RFB message with the arguments provided. It doesn't modify them in any way.

http://www.s-code.com/App_Themes/Default/images/blue_line.gif
Regards,
Yury Averkiev, SmartCode

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Explore
Messages
Mentions
Search