本文整理汇总了Python中pythoncom.CoUninitialize方法的典型用法代码示例。如果您正苦于以下问题:Python pythoncom.CoUninitialize方法的具体用法?Python pythoncom.CoUninitialize怎么用?Python pythoncom.CoUninitialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pythoncom
的用法示例。
在下文中一共展示了pythoncom.CoUninitialize方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DoTestInterpInThread
# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CoUninitialize [as 别名]
def DoTestInterpInThread(cookie):
try:
pythoncom.CoInitialize()
myThread = win32api.GetCurrentThreadId()
GIT = CreateGIT()
interp = GIT.GetInterfaceFromGlobal(cookie, pythoncom.IID_IDispatch)
interp = win32com.client.Dispatch(interp)
TestInterp(interp)
interp.Exec("import win32api")
print "The test thread id is %d, Python.Interpreter's thread ID is %d" % (myThread, interp.Eval("win32api.GetCurrentThreadId()"))
interp = None
pythoncom.CoUninitialize()
except:
traceback.print_exc()
示例2: _doTestInThread
# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CoUninitialize [as 别名]
def _doTestInThread(self, interp):
pythoncom.CoInitialize()
myThread = win32api.GetCurrentThreadId()
if freeThreaded:
interp = pythoncom.CoGetInterfaceAndReleaseStream(interp, pythoncom.IID_IDispatch)
interp = win32com.client.Dispatch(interp)
interp.Exec("import win32api")
#print "The test thread id is %d, Python.Interpreter's thread ID is %d" % (myThread, interp.Eval("win32api.GetCurrentThreadId()"))
pythoncom.CoUninitialize()
示例3: testall
# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CoUninitialize [as 别名]
def testall():
dotestall()
pythoncom.CoUninitialize()
print "AXScript Host worked correctly - %d/%d COM objects left alive." % (pythoncom._GetInterfaceCount(), pythoncom._GetGatewayCount())
示例4: serve
# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CoUninitialize [as 别名]
def serve(clsids):
infos = factory.RegisterClassFactories(clsids)
pythoncom.EnableQuitMessage(win32api.GetCurrentThreadId())
pythoncom.CoResumeClassObjects()
pythoncom.PumpMessages()
factory.RevokeClassFactories( infos )
pythoncom.CoUninitialize()
示例5: get_hardware_info
# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CoUninitialize [as 别名]
def get_hardware_info(response):
pythoncom.CoInitialize()
win32 = wmi.WMI()
hardware = response["hardware"]
hardware.append({Klanguage().to_ts(1011) : [get_cpu_info()]})
#hardware.append({'Memory' : [""]})
hardware.append({Klanguage().to_ts(1016) : get_disk_partition(win32)})
hardware.append({Klanguage().to_ts(1017) : [get_bios_info()]})
hardware.append({Klanguage().to_ts(1013) : get_gpu_info(win32)})
hardware.append({Klanguage().to_ts(1012) : get_network_card_info()})
pythoncom.CoUninitialize()
示例6: stop
# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CoUninitialize [as 别名]
def stop(self):
"""Stop the running thread gracefully."""
print("Stopping thread...")
self.keep_running = False
# Wait for the thread to stop
self.wait()
print("Thread stopped")
# Uninitialize at thread stop (used for WMI in thread)
pythoncom.CoUninitialize()
示例7: get_table_where
# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CoUninitialize [as 别名]
def get_table_where(self, tname, where={}):
try:
pythoncom.CoInitialize()
c = WMI()
f = getattr(c, tname)
return f(**where)
finally:
pythoncom.CoUninitialize()
示例8: Quit
# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CoUninitialize [as 别名]
def Quit(self):
self.excel.Quit()
pythoncom.CoUninitialize()
示例9: __exit__
# 需要导入模块: import pythoncom [as 别名]
# 或者: from pythoncom import CoUninitialize [as 别名]
def __exit__(self, _type, _value, _traceback):
pythoncom.CoUninitialize()