Home >Computer Tutorials >Computer Knowledge >How to obtain the X coordinate of a specified window through Yi Language

How to obtain the X coordinate of a specified window through Yi Language

王林
王林forward
2024-01-24 22:33:191448browse

How to obtain the X coordinate of a specified window through Yi Language

How to get the X Y coordinates in the specified window in Yi Language

Pure api and core support library operations, no modules required, create a clock, the source code is as follows:

.Version 2

.dll command getparent, integer type, "user32", "getparent", , $(b) Determine the handle of the parent window of the specified window. If the window has no parent, or an error is encountered, zero is returned. will set getlasterror

.Parameter window handle, integer type, , handle of the window to be tested;

.dll command getwindowrect, integer type, "user32", "getwindowrect"

.Parameter window handle, integer type

.Parameter rectangular area, rectangle_

.Version 2

.Data type rectangle_, public, rect

.Member left, integer type, , , left

.Member top edge, integer type, , , top

.Member right, integer type, , , right

.Member bottom, integer type, , , bottom

.Version 2

.Support library eapi

.Subroutine __start window_created

Clock 1. Clock period = 2000

.Subroutine _Clock 1_Period Event

.Local variable hwnd, integer type

.Local variable hwnd_p, integer type

.Local variable rect, rectangle_

hwnd = Get the handle of the window where the mouse is located ()

hwnd_p = getparent (hwnd)

getwindowrect (hwnd_p, rect)

.If (hwnd_p ≠ 0)

Output debug text ("top left corner coordinates: ("to text (rect.left)","to text (rect.top)")")

Output debug text ("Lower left top corner coordinates: (" to text (rect.left) "," to text (rect.bottom) ")")

Output debug text ("top right corner coordinates: (" to text (rect.right) "," to text (rect.top) ")")

Output debug text ("Lower right top corner coordinates: (" to text (rect.right) "," to text (rect.bottom) ")")

Output debugging text ("——————————————————————")

.otherwise

Output debug text ("Window has no parent window")

.If it ends

How to record mouse clicks in Yi Language

The following code: .Version 2

.Support Library EdirectX.Assembly Window Assembly 1

.Assembly variable number of left clicks, integer type

.Assembly variable number of right clicks, integer type. Subroutine __Start window_Created input device 1. Set refresh time (50)

Input device 1. Select input device (True, False, False)

Input device 1.Initialization (0)

Number of left clicks = 0

Number of right clicks = 0. Subroutine _Input device 1_Mouse button is changed

.Parameter key value, integer type

.Parameter key state, integer type. If true (key value = 256 and key state

State = 1) 'The left button is pressed and released

Number of left clicks = Number of left clicks 1

Tag 1. Title = "The left mouse button was clicked" to text (number of left clicks) "times"

.End if true. If true (key value = 257 and key status = 1) 'The right button is pressed and released

Tag 2. Title = "The left mouse button was clicked" to text (number of left clicks) "times"

.If it really ends

The above is the detailed content of How to obtain the X coordinate of a specified window through Yi Language. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:docexcel.net. If there is any infringement, please contact admin@php.cn delete