How I simulate dragging the mouse in other Windows apps using C# SendInput function. A download from codeproject.com is used to build functions to drag the left and right mouse.
InputSender Download:
https://www.codeproject.com/Articles/...
C# Automation Playlist:
• C# Automation
#csharp
private void LeftDrag(Point start, Point end)
{
InputSender.SetCursorPosition(start.X, start.Y);
InputSender.SendMouseInput(new InputSender.MouseInput[]
{
new InputSender.MouseInput
{
dwFlags = (uint)InputSender.MouseEventF.LeftDown
}
});
Thread.Sleep(100);
InputSender.SetCursorPosition(end.X, end.Y);
// added to fix text not always being selected during drag
Thread.Sleep (100);
InputSender.SendMouseInput(new InputSender.MouseInput[]
{
new InputSender.MouseInput
{
dwFlags = (uint)InputSender.MouseEventF.LeftUp
}
});
}
On this page of the site you can watch the video online C# - Simulate mouse drag with SendInput (codeproject implementation) with a duration of hours minute second in good quality, which was uploaded by the user JFLHV 15 October 2022, share the link with friends and acquaintances, this video has already been watched 1,806 times on youtube and it was liked by 8 viewers. Enjoy your viewing!