您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Python 开发Activex组件方法

2026/1/21 22:41:19发布14次查看
使用win32com模块开发window activex的示例:(如果你还没有装win32com模块的话,请到http://python.net/crew/skippy/win32/downloads.html下载)。
复制代码 代码如下:
# simplecomserver.py
class pythonutilities:
_public_methods_ = ['splitstring']
_reg_progid_ = python.utilities
_reg_clsid_ = {a6688635-62f5-41cb-af54-cba84c2f0f86}
def splitstring(self, val):
return hello world , val
if __name__ == '__main__':
print registering com server...
import win32com.server.register
win32com.server.register.usecommandline(pythonutilities)
在console下运行:python simplecomserver.py
在html页面中调用该activex组件:
复制代码 代码如下:
window.onload = function(){
    var obj = new activexobject(python.utilities);
alert(obj.splitstring(hel));
}
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product