文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>python com ...

python com ...

时间:2010-08-12  来源:lqefn

from win32com.client import *

vt = {0: 'VT_EMPTY', 1: 'VT_NULL', 2: 'VT_I2', 3: 'VT_I4', 4: 'VT_R4', 5: 'VT_R8', 6: 'VT_CY', 7: 'VT_DATE',

8: 'VT_BSTR', 9: 'VT_DISPATCH', 10: 'VT_ERROR', 11: 'VT_BOOL', 12: 'VT_VARIANT', 13: 'VT_UNKNOWN', 

14: 'VT_DECIMAL', 16: 'VT_I1', 17: 'VT_UI1', 18: 'VT_UI2', 19: 'VT_UI4', 20: 'VT_I8', 21: 'VT_UI8',

22: 'VT_INT', 23: 'VT_UINT', 24: 'VT_VOID', 25: 'VT_HRESULT', 26: 'VT_PTR', 27: 'VT_SAFEARRAY', 

28: 'VT_CARRAY', 29: 'VT_USERDEFINED', 30: 'VT_LPSTR', 31: 'VT_LPWSTR', 4096: 'VT_VECTOR', 36: 'VT_RECORD', 

8192: 'VT_ARRAY', 16384: 'VT_BYREF', 32768: 'VT_RESERVED', 64: 'VT_FILETIME', 65: 'VT_BLOB', 66: 'VT_STREAM',

67: 'VT_STORAGE', 68: 'VT_STREAMED_OBJECT', 69: 'VT_STORED_OBJECT', 70: 'VT_BLOB_OBJECT', 71: 'VT_CF', 

72: 'VT_CLSID', 65535: 'VT_ILLEGAL', 4095: 'VT_TYPEMASK'}

con = Dispatch("adodb.connection")

obj = con._oleobj_

tpinf = obj.GetTypeInfo()

tpattr = tpinf.GetTypeAttr()

nfun = tpattr.cFuncs

funs = []

for i in range(nfun):

funs.append(tpinf.GetFuncDesc(i))

for f in funs:

names = tpinf.GetNames(f.memid)

if len(names) == 1:

print(names[0] + "()")

else:

argnames = names[1:]

defs = [str(a[-1]) for a in f.args]

tps = [vt[t[0][0] if type(t[0]) is tuple else t[0]] for t in f.args]

#print("types:", tps)

args = [" = ".join([v, defs[i]]) for i,v in enumerate(argnames)]

args = [" ".join([tps[i], a]) for i, a in enumerate(args)]

print(names[0] + "(" + ", ".join(args) + ")")

相关阅读 更多 +
排行榜 更多 +
找茬脑洞的世界安卓版

找茬脑洞的世界安卓版

休闲益智 下载
滑板英雄跑酷2手游

滑板英雄跑酷2手游

休闲益智 下载
披萨对对看下载

披萨对对看下载

休闲益智 下载