不知道你具体是什么问题,下面是python调用win msgbox 和shellexec的方法,可以参考一下:
import ctypes#win api shellexecuteapiA and msgboxA
def execute(path):
handler = None
operator = "open"
fpath = path
param = None
dirpath = None
ncmd = 1
shell32 = ctypes.windll.LoadLibrary("shell32.dll")
shell32.ShellExecuteA(handler,operator,fpath,param,dirpath,ncmd)
def msgbox(msg='mesage'):
user32 = ctypes.windll.LoadLibrary('user32.dll')
user32.MessageBoxA(0, msg.decode('utf8').encode('gbk'), 'aaaaaaa',0)
if __name__ == '__main__':
execute('config.ini')
msgbox('aaaaaa')
参考地址:http://www.pubwin2009.net/index.php/python/27.html
import clrimport System
clr.AddReferenceToFile("SimpleHash.dll")
from Common import *
class HashPy(SimpleHash):
def __init__(self):
pass
def HashCalc(self,arg1,arg2):
#str to byte[]
arg1=System.Text.Encoding.Default.GetBytes(arg1)
arg2=System.Text.Encoding.Default.GetBytes(arg2)
return SimpleHash.HashCalc(self,arg1,arg2)
audiobuff='1234567812345678123456781234567812345678123456781234567812345678\
123456781234567812345678123456781234567812345678123456781234567812345678\
123456781234567812345678123456781234567812345678123456781234567812345678\
1234567812345678123456781234567812345678123456781234567812345678'
key='12345678'
print HashPy().HashCalc(audiobuff,key)
python ctype只能调用c/c++. 你要调用c#的dll 要用IronPython。如上面的例子