当前位置:   article > 正文

python安装win32api_python win32 调用win32下的API

python win32

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 =

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/109314
推荐阅读
相关标签
  

闽ICP备14008679号