Quantcast
Channel: 布団が俺を呼んでいる
Viewing all articles
Browse latest Browse all 135

画面をクリックする (マウスクリック)

$
0
0
珍しく全力で仕事したせいで、指が痛い……。
というわけで、指を使わなくても自動でクリックするためのプログラム。
※自分メモ。

using System.Runtime.InteropServices;namespace ConsoleApplication1
{    class Program    {        [DllImport("USER32.dll", CallingConvention = CallingConvention.StdCall)]        static extern void SetCursorPos(int X, int Y);        [DllImport("USER32.dll", CallingConvention = CallingConvention.StdCall)]        static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);                private const int MOUSEEVENTF_LEFTDOWN = 0x2;        private const int MOUSEEVENTF_LEFTUP = 0x4;        static void Main(string[] args)        {            SetCursorPos(300, 300);            mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);            mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);        }    }
}


100倍クリックされる 超Webライティング実践テク60

新品価格
¥3,280から
(2017/6/11 20:41時点)


Viewing all articles
Browse latest Browse all 135

Trending Articles