py 使用win32 api
- http://timgolden.me.uk/pywin32-docs/contents.html
- https://docs.python.org/3/library/ctypes.html#ctypes.WinDLL
安装 pywin32
pip install pywin32 -i https://pypi.tuna.tsinghua.edu.cn/simple
使用
main.py
import win32api
import win32com.client
win32api.MessageBox(0, "body", "caption", 0)
speack = win32com.client.Dispatch("SAPI.SpVoice")
speack.Speak("abc")
λ python main.py
外部读写内存
from ctypes import *
PROCESS_ALL_ACCESS = 2097151
kernel32 = windll.kernel32
hProcess = kernel32.OpenProcess(PROCESS_ALL_ACCESS, False, 10256)
print("hProcess: ", hProcess)
if hProcess == 0:
print("OpenProcess error.")
exit()
val = c_uint32(0)
if kernel32.ReadProcessMemory(hProcess, 0x4B3724, byref(val), sizeof(val), 0) == 0:
print("ReadProcessMemory error.")
exit()
print("Current HP: ", val.value)
newval = c_uint32(100)
if kernel32.WriteProcessMemory(hProcess, 0x4B3724, byref(newval), sizeof(newval), 0) == 0:
print("WriteProcessMemory error.")
exit()
if kernel32.ReadProcessMemory(hProcess, 0x4B3724, byref(val), sizeof(val), 0) == 0:
print("ReadProcessMemory error.")
exit()
print("New HP: ", newval.value)
kernel32.CloseHandle(hProcess)
λ python main.py
hProcess: 496
Current HP: 42
New HP: 100
py 使用win32 api的更多相关文章
- 初次认识 C# win32 api
第一次接触win32api,刚开始的时候有点迷迷糊糊的. Windows API 就是windows应用程序接口. win api向上就是windows应用程序,向下就是windows操作系统核心. ...
- Serial Port Programming using Win32 API(转载)
In this tutorial we will learn How to communicate with an external device like a microcontroller boa ...
- 从.NET平台调用Win32 API
MSDN文章<Microsoft Win32 to Microsoft .NET Framework API Map> 介绍了.net 类库对win32的封装 从.NET平台调用Win32 ...
- 【温故Delphi】GAEA用到Win32 API目录
Delphi是Windows平台下著名的快速应用程序开发工具,它在VCL中封装并使用了大量的Win32 API. GAEA基于VCL开发的工具类产品,在程序中使用了大量的Win32 API,将经常用到 ...
- 【C#】分享基于Win32 API的服务操作类(解决ManagedInstallerClass.InstallHelper不能带参数安装的问题)
注:这里的服务是指Windows 服务. ------------------201508250915更新------------------ 刚刚得知TransactedInstaller类是支持带 ...
- C#中导入Win32 API函数
C#中导入Win32 API的方法: 1.引用命名空间 using System.Net.Security; using System.Runtime.InteropServices; 2. [Dll ...
- MSIL 教程(二):数组、分支、循环、使用不安全代码和如何调用Win32 API(转)
转自:http://www.cnblogs.com/Yahong111/archive/2007/08/16/857574.html 续上文[翻译]MSIL 教程(一) ,本文继续讲解数组.分支.循环 ...
- C#调用Win32 api学习总结
从.NET平台调用Win32 API Win32 API可以直接控制Microsoft Windows的核心,因为API(Application Programming Interface)本来就是微 ...
- win32 api ShouCursor 根据内部计数器 是否>= 0 决定是否 显示光标,每true时计数器+1,每false-1
win32 api ShouCursor 根据内部计数器 是否>= 0 决定是否 显示光标,每true时计数器+1,每false-1,编程时true 和 false 的次数容易产生bug.
随机推荐
- KDB调试 — ARM
1 寄存器 1.1 通用寄存器 A64指令集可以看到31个64位通用(整数)寄存器,分别是R0-R30. 在64位上下文中,这些寄存器通常使用名称x0-x30来表示; 在 ...
- ReentrantReadWriteLock读写锁简单原理案例证明
ReentrantReadWriteLock存在原因? 我们知道List的实现类ArrayList,LinkedList都是非线程安全的,Vector类通过用synchronized修饰方法保证了Li ...
- SpringMVC听课笔记(十:处理JSON: 使用HttpMessageConverter)
1. 处理JSON 2. 原理 流程图 3. 看个应用吧 -- 上传 ①jsp ②handler -- 下载 ① jsp ② handler
- Docker中运行nginx
Docker中运行nginx 1.Docker中运行nginx 2.配置文件 2.1 nginx.conf 2.2 default.conf 3.docker的镜像可以挂什么卷 部分内容原文地址: C ...
- linux 文件目录解释笔记(未完待续...)
目录 应放置档案内容 /bin 系统有很多放置执行档的目录,但/bin比较特殊.因为/bin放置的是在单人维护模式下还能够被操作的指令. 在/bin底下的指令可以被root与一般帐号所使用,主要有:c ...
- Kubernetes --(k8s)Job、CronJob
Job https://www.kubernetes.org.cn/job https://www.kubernetes.org.cn/cronjob Job负责批量处理短暂的一次性任务 (short ...
- HDU5213 Lucky【容斥+莫队】
HDU5213 Lucky 题意: 给出\(N\)个数和\(k\),有\(m\)次询问,每次询问区间\([L1,R1]\)和区间\([L2,R2]\)中分别取一个数能相加得到\(k\)的方案数 题解: ...
- easyx学习心得
前几天算法课的实验要求实现可视化,搞了半天没动咋实现,然后有大佬说用easyx,,,我寻思着也没教这玩意咋用啊.然后很烦躁的上网找教程,发现没有教怎么使用的,都说有一本说明书(链接),自己调用函数就可 ...
- codeforces 128B. String
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- JavaScript函数console、this关键字
console.dir()打印出来的东西不加任何操作 console.log()打印出来东西实现进行了操作,打印出来的东西可能不是原型 具体对象的类型可以在"_proto_"中看, ...