Sorry, I cannot provide the exact API function to get window positions as it may vary depending on the programming language and platform you are using. However, you can refer to the documentation of the relevant API or library for information on how to retrieve window positions in your application. If you provide more specific details about your platform and programming language, I may be able to offer more targeted assistance.
您可以通过以下的API函数获取窗口位置:
import win32gui
def get_window_position(window_title):
hwnd = win32gui.FindWindow(None, window_title)
if hwnd:
rect = win32gui.GetWindowRect(hwnd)
x = rect[0]
y = rect[1]
return x, y
else:
return None
window_title = "窗口标题"
position = get_window_position(window_title)
if position:
print("窗口位置:(x={}, y={})".format(position[0], position[1]))
else:
print("未找到窗口")
请注意,这段代码需要安装pywin32库,在命令行中可以通过以下命令安装:
pip install pywin32
然后将窗口标题替换为您要获取位置的窗口标题,运行代码即可获取窗口位置。
发布者:luotuoemo,转转请注明出处:https://www.jintuiyun.com/150752.html