1 Star 5 Fork 2

高永献/pydmdll

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
dmdll_test.py 1.42 KB
一键复制 编辑 原始数据 按行查看 历史
gaoyongxian 提交于 2021-10-26 10:37 . bug
# -*- coding: UTF-8 -*-
"""
@Project :pydmdll
@File :dmdll_test.py
@Author :Gao yongxian
@Date :2021/10/25 10:19
@contact: g1695698547@163.com
"""
import os
import time
from pydmdll import DM
if __name__ == '__main__':
dm = DM()
# dm = DM(dll_path="你自己的版本路径-绝对路径")
# 取消注册
# dm.Un_reg()
# 打开记事本
os.system("start notepad.exe")
time.sleep(1)
# 窗口句柄就是一个int类型的数字
txt_hwnd = dm.FindWindow("", "记事本")
print(txt_hwnd)
# 最大化指定窗口,同时激活窗口.
f = dm.SetWindowState(txt_hwnd, 4)
# print(f)
# 使记事本窗口移动
dm.MoveWindow(txt_hwnd, 10, 10)
print("GetWindowProcessPath",dm.GetWindowProcessPath(txt_hwnd))
print("dm.GetWindowState(txt_hwnd,1)",dm.GetWindowState(txt_hwnd,4))
# 打印注册路径
path = dm.GetBasePath()
print(path)
# 获取剪贴板
print(dm.GetClipboard())
# 获取标题还有.py的所有句柄
# 注意:返回的是str,但句柄必须是int类型,要强行转化
# hwnd_str_list=dm.EnumWindow(0,".py","",1+2+4+8).split(",")
# print(hwnd_str_list)
# for hwnd in hwnd_str_list:
# print(dm.GetWindowClass(int(hwnd)))
# print(dm.GetWindowProcessPath(int(hwnd)))
# print(dm.GetWindowTitle(int(hwnd)))
# dm.MoveWindow(int(hwnd),100,100)
# 推荐相对移动
dm.MoveR(40, 10)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/gao_yongxian/pydmdll.git
git@gitee.com:gao_yongxian/pydmdll.git
gao_yongxian
pydmdll
pydmdll
main

搜索帮助