赞
踩
python调用vc中的API
准备工作: 安装pywin32-210.5.win32-py2.5.exe
例1:最简单的MessageBox函数
import win32api, win32gui
import win32con, winerror,win32event,pywintypes
import sys, os,time
win32api.MessageBox(0,'hello', 'WYM',win32con.MB_OK)
例2:进程监控
#Mutex.py
mutex=None
mutex=win32event.CreateMutex(None,pywintypes.FALSE,"MutexWym")
if(win32api.GetLastError() == winerror.ERROR_ALREADY_EXISTS):
print"Opened existing mutex object", mutex
else:
print "Created new mutex"
time.sleep(10)
win32api.CloseHandle(mutex)
print "close Mutex"
time.sleep(10)
#MonitorProcess.py
import win32api, win32gui
import win32con, winerror,win32event ,pywintypes
import sys, os,time
STANDARD_RIGHTS_REQUIRED =
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。