{"id":68,"date":"2023-07-09T15:31:36","date_gmt":"2023-07-09T06:31:36","guid":{"rendered":"https:\/\/rafa-system.com\/vba\/?p=68"},"modified":"2023-07-09T15:31:37","modified_gmt":"2023-07-09T06:31:37","slug":"post-68","status":"publish","type":"post","link":"https:\/\/rafa-system.com\/vba\/2023\/07\/09\/post-68\/","title":{"rendered":"\u30de\u30a6\u30b9\u306e\u64cd\u4f5c"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u30de\u30a6\u30b9\u306e\u5ea7\u6a19\u53d6\u5f97<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>'\u30de\u30a6\u30b9\u306e\u5ea7\u6a19\u53d6\u5f97\r\nPrivate Declare PtrSafe Function GetCursorPos Lib \"user32\" (lpPoint As POINTAPI) As Long\r\nPrivate Type POINTAPI\r\n    x As Long\r\n    y As Long\r\nEnd Type\r\n\r\n'\u30de\u30a6\u30b9\u306e\u5ea7\u6a19\u3092\u51fa\u529b\r\nPublic Sub printMousePosition()\r\n    Dim Pos As POINTAPI\r\n    GetCursorPos Pos\r\n    Debug.Print \"x(\u6a2a\u8ef8): \" &amp; Pos.x\r\n    Debug.Print \"y(\u7e26\u8ef8): \" &amp; Pos.y\r\nEnd Sub<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u30de\u30a6\u30b9\u306e\u79fb\u52d5<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>Private Declare PtrSafe Function SetCursorPos Lib \"user32\" (ByVal x As Long, ByVal y As Long) As Long\r\n\r\nSub moveMouse()\r\n\r\n    SetCursorPos 100, 100\r\n\r\nEnd Sub<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u30de\u30a6\u30b9\u306e\u30af\u30ea\u30c3\u30af<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u203b\u4e00\u5fdc\u52d5\u304f\u3051\u3069\u4ed5\u7d44\u307f\u306f\u3088\u304f\u308f\u304b\u3089\u306a\u3044<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>'\u30de\u30a6\u30b9\u30af\u30ea\u30c3\u30af\u64cd\u4f5c\r\n'https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/api\/winuser\/nf-winuser-mouse_event\r\nPrivate Declare PtrSafe Sub mouse_event Lib \"user32.dll\" ( _\r\n     ByVal dwFlags As Long, _\r\n     ByVal dx As Long, _\r\n     ByVal dy As Long, _\r\n     ByVal cButtons As Long, _\r\n     ByVal dwExtraInfo As Long)\r\n\r\nConst MOUSEEVENTF_ABSOLUTE As Long = &amp;H8000\r\nConst MOUSEEVENTF_LEFTDOWN As Long = &amp;H2\r\nConst MOUSEEVENTF_LEFTUP As Long = &amp;H4\r\nConst MOUSEEVENTF_MIDDLEDOWN As Long = &amp;H20\r\nConst MOUSEEVENTF_MIDDLEUP As Long = &amp;H40\r\nConst MOUSEEVENTF_MOVE As Long = &amp;H1\r\nConst MOUSEEVENTF_RIGHTDOWN As Long = &amp;H8\r\nConst MOUSEEVENTF_RIGHTUP As Long = &amp;H10\r\nConst MOUSEEVENTF_XDOWN As Long = &amp;H80\r\nConst MOUSEEVENTF_XUP As Long = &amp;H100\r\nConst MOUSEEVENTF_WHEEL As Long = &amp;H800\r\n\r\nPublic Sub mouseLeftClick(ByVal x As Long, ByVal y As Long)\r\n    SetCursorPos x, y\r\n    mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\r\n    mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\r\nEnd Sub\r\n\r\n'\u6307\u5b9a\u3057\u305f\u5ea7\u6a19\u3067\u5de6\u30af\u30ea\u30c3\u30af\u3059\u308b\r\nSub testing()\r\n    mouseLeftClick 300, 300\r\nEnd Sub<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u30de\u30a6\u30b9\u306e\u5ea7\u6a19\u53d6\u5f97 \u30de\u30a6\u30b9\u306e\u79fb\u52d5 \u30de\u30a6\u30b9\u306e\u30af\u30ea\u30c3\u30af \u203b\u4e00\u5fdc\u52d5\u304f\u3051\u3069\u4ed5\u7d44\u307f\u306f\u3088\u304f\u308f\u304b\u3089\u306a\u3044<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[10],"class_list":["post-68","post","type-post","status-publish","format-standard","hentry","category-function","tag-windowsapi"],"_links":{"self":[{"href":"https:\/\/rafa-system.com\/vba\/wp-json\/wp\/v2\/posts\/68","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rafa-system.com\/vba\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rafa-system.com\/vba\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rafa-system.com\/vba\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rafa-system.com\/vba\/wp-json\/wp\/v2\/comments?post=68"}],"version-history":[{"count":1,"href":"https:\/\/rafa-system.com\/vba\/wp-json\/wp\/v2\/posts\/68\/revisions"}],"predecessor-version":[{"id":69,"href":"https:\/\/rafa-system.com\/vba\/wp-json\/wp\/v2\/posts\/68\/revisions\/69"}],"wp:attachment":[{"href":"https:\/\/rafa-system.com\/vba\/wp-json\/wp\/v2\/media?parent=68"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rafa-system.com\/vba\/wp-json\/wp\/v2\/categories?post=68"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rafa-system.com\/vba\/wp-json\/wp\/v2\/tags?post=68"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}