![]() |
|
Just Some Fooling Around - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Visual Basic & .NET Framework (https://sinister.li/Forum-Visual-Basic-NET-Framework) +--- Thread: Just Some Fooling Around (/Thread-Just-Some-Fooling-Around) |
Just Some Fooling Around - ArkPhaze - 05-26-2012 A simple app I created in a few minutes earlier today while I was bored, (this is emulation in Paint): ![]() ![]()
RE: Just Some Fooling Around - z0rk - 05-26-2012 Can you post the source code? RE: Just Some Fooling Around - Coder-san - 05-26-2012 Haha, nice. ![]() Is it looping your mouse actions? RE: Just Some Fooling Around - ArkPhaze - 05-26-2012 Here's the source: Code: using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Threading;
namespace CSharp_Project
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
//TopMost = true;
}
private enum MOUSEEVENTF
{
ABSOLUTE = 0x8000,
LEFTDOWN = 0x0002,
LEFTUP = 0x0004,
MIDDLEDOWN = 0x0020,
MIDDLEUP = 0x0040,
MOVE = 0x0001,
RIGHTDOWN = 0x0008,
RIGHTUP = 0x0010,
WHEEL = 0x0800,
XDOWN = 0x0080,
XUP = 0x0100
}
private const int e_interval = 0;
private const int e_speed = 2;
[DllImport("USER32.DLL", EntryPoint = "mouse_event", SetLastError = true)]
private unsafe static extern void mouse_event(
MOUSEEVENTF dwFlags,
int dx,
int dy,
int dwData,
UInt64* dwExtraInfo
);
private unsafe void button1_Click(object sender, EventArgs e)
{
new Thread(StartEvents).Start();
}
private unsafe void StartEvents()
{
Thread.Sleep(2000); //Initial delay time before starting
UInt64 NullInt = 0;
int[] disp = { 0, 0 };
for (int i = 1; i < 10; i++)
{
Thread.Sleep(e_interval);
IEnumerable<int[]> fPoints = File.ReadAllLines(@"D:\file_points.txt")
.Select(ln => new int[] { Convert.ToInt32(ln.Split(',')[0]),
Convert.ToInt32(ln.Split(',')[1]) });
foreach (int[] pts in fPoints)
{
mouse_event(MOUSEEVENTF.MOVE, pts[0], pts[1], 0, &NullInt);
Thread.Sleep(e_speed);
}
mouse_event(MOUSEEVENTF.MOVE, disp[0], disp[1], 0, &NullInt); //Move Mouse New Displacement
}
}
}
} |