本文整理汇总了Python中pythoncom._GetInterfaceCount函数的典型用法代码示例。如果您正苦于以下问题:Python _GetInterfaceCount函数的具体用法?Python _GetInterfaceCount怎么用?Python _GetInterfaceCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_GetInterfaceCount函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test
def test(fn):
print "The main thread is %d" % (win32api.GetCurrentThreadId())
GIT = CreateGIT()
interp = win32com.client.Dispatch("Python.Interpreter")
cookie = GIT.RegisterInterfaceInGlobal(interp._oleobj_, pythoncom.IID_IDispatch)
events = fn(4, cookie)
numFinished = 0
while 1:
try:
rc = win32event.MsgWaitForMultipleObjects(events, 0, 2000, win32event.QS_ALLINPUT)
if rc >= win32event.WAIT_OBJECT_0 and rc < win32event.WAIT_OBJECT_0 + len(events):
numFinished = numFinished + 1
if numFinished >= len(events):
break
elif rc == win32event.WAIT_OBJECT_0 + len(events): # a message
# This is critical - whole apartment model demo will hang.
pythoncom.PumpWaitingMessages()
else: # Timeout
print "Waiting for thread to stop with interfaces=%d, gateways=%d" % (
pythoncom._GetInterfaceCount(),
pythoncom._GetGatewayCount(),
)
except KeyboardInterrupt:
break
GIT.RevokeInterfaceFromGlobal(cookie)
del interp
del GIT
开发者ID:arizvisa,项目名称:pywin32,代码行数:28,代码来源:testGIT.py
示例2: testall
def testall():
dotestall()
pythoncom.CoUninitialize()
print "AXScript Host worked correctly - %d/%d COM objects left alive." % (
pythoncom._GetInterfaceCount(),
pythoncom._GetGatewayCount(),
)
开发者ID:hinike,项目名称:opera,代码行数:7,代码来源:leakTest.py
示例3: __call__
def __call__(self, result = None):
# Always ensure we don't leak gateways/interfaces
gc.collect()
ni = _GetInterfaceCount()
ng = _GetGatewayCount()
self.real_test(result)
# Failed - no point checking anything else
if result.shouldStop or not result.wasSuccessful():
return
self._do_leak_tests(result)
gc.collect()
lost_i = _GetInterfaceCount() - ni
lost_g = _GetGatewayCount() - ng
if lost_i or lost_g:
msg = "%d interface objects and %d gateway objects leaked" \
% (lost_i, lost_g)
result.addFailure(self.real_test, (AssertionError, msg, None))
开发者ID:CoDEmanX,项目名称:ArangoDB,代码行数:17,代码来源:util.py
示例4: release
def release():
global _release_fns
for fn in _release_fns:
fn()
time.sleep(0.1)
refcount = pythoncom._GetInterfaceCount()
if refcount > 0:
print "Warning! %d COM references still alive"
print "HFSS will likely refuse to shut down"
开发者ID:Theau,项目名称:pyHFSS,代码行数:9,代码来源:hfss.py
示例5: CheckClean
def CheckClean():
# Ensure no lingering exceptions - Python should have zero outstanding
# COM objects
sys.exc_clear()
c = _GetInterfaceCount()
if c:
print "Warning - %d com interface objects still alive" % c
c = _GetGatewayCount()
if c:
print "Warning - %d com gateway objects still alive" % c
开发者ID:CoDEmanX,项目名称:ArangoDB,代码行数:10,代码来源:util.py
示例6: __call__
def __call__(self, result = None):
# For the COM suite's sake, always ensure we don't leak
# gateways/interfaces
from pythoncom import _GetInterfaceCount, _GetGatewayCount
gc.collect()
ni = _GetInterfaceCount()
ng = _GetGatewayCount()
self.real_test(result)
# Failed - no point checking anything else
if result.shouldStop or not result.wasSuccessful():
return
self._do_leak_tests(result)
gc.collect()
lost_i = _GetInterfaceCount() - ni
lost_g = _GetGatewayCount() - ng
if lost_i or lost_g:
msg = "%d interface objects and %d gateway objects leaked" \
% (lost_i, lost_g)
exc = AssertionError(msg)
result.addFailure(self.real_test, (exc.__class__, exc, None))
开发者ID:AT-GROUP,项目名称:AT-PLANNER,代码行数:20,代码来源:pywin32_testutil.py
示例7: CheckClean
def CheckClean():
# Ensure no lingering exceptions - Python should have zero outstanding
# COM objects
try:
sys.exc_clear()
except AttributeError:
pass # py3k
c = _GetInterfaceCount()
if c:
print("Warning - %d com interface objects still alive" % c)
c = _GetGatewayCount()
if c:
print("Warning - %d com gateway objects still alive" % c)
开发者ID:BrokenFang,项目名称:Scraper2,代码行数:13,代码来源:util.py
示例8: main
num = num + 1
finally:
win32api.RegCloseKey(key)
win32ui.DoWaitCursor(0)
ret.sort()
return ret
def main():
from pywin.tools import hierlist
root = HLIRoot("COM Browser")
if sys.modules.has_key("app"):
# do it in a window
browser.MakeTemplate()
browser.template.OpenObject(root)
else:
# list=hierlist.HierListWithItems( root, win32ui.IDB_BROWSER_HIER )
# dlg=hierlist.HierDialog("COM Browser",list)
dlg = browser.dynamic_browser(root)
dlg.DoModal()
if __name__=='__main__':
main()
ni = pythoncom._GetInterfaceCount()
ng = pythoncom._GetGatewayCount()
if ni or ng:
print "Warning - exiting with %d/%d objects alive" % (ni,ng)
开发者ID:CoDEmanX,项目名称:ArangoDB,代码行数:29,代码来源:combrowse.py
示例9: len
elif medium.tymed==pythoncom.TYMED_MFPICT:
data = "METAFILE handle %d" % medium.data
elif medium.tymed==pythoncom.TYMED_ENHMF:
data = "ENHMETAFILE handle %d" % medium.data
elif medium.tymed==pythoncom.TYMED_HGLOBAL:
data = "%d bytes via HGLOBAL" % len(medium.data)
elif medium.tymed==pythoncom.TYMED_FILE:
data = "filename '%s'" % data
elif medium.tymed==pythoncom.TYMED_ISTREAM:
stream = medium.data
stream.Seek(0,0)
bytes = 0
while 1:
chunk = stream.Read(4096)
if not chunk:
break
bytes += len(chunk)
data = "%d bytes via IStream" % bytes
elif medium.tymed==pythoncom.TYMED_ISTORAGE:
data = "a IStorage"
else:
data = "*** unknown tymed!"
print " -> got", data
do = None
if __name__=='__main__':
DumpClipboard()
if pythoncom._GetInterfaceCount()+pythoncom._GetGatewayCount():
print "XXX - Leaving with %d/%d COM objects alive" % \
(pythoncom._GetInterfaceCount(), pythoncom._GetGatewayCount())
开发者ID:BwRy,项目名称:rcs-db-ext,代码行数:30,代码来源:dump_clipboard.py
示例10: fn
events = fn(4, cookie)
numFinished = 0
while 1:
try:
rc = win32event.MsgWaitForMultipleObjects(events, 0, 2000, win32event.QS_ALLINPUT)
if rc >= win32event.WAIT_OBJECT_0 and rc < win32event.WAIT_OBJECT_0+len(events):
numFinished = numFinished + 1
if numFinished >= len(events):
break
elif rc==win32event.WAIT_OBJECT_0 + len(events): # a message
# This is critical - whole apartment model demo will hang.
pythoncom.PumpWaitingMessages()
else: # Timeout
print("Waiting for thread to stop with interfaces=%d, gateways=%d" % (pythoncom._GetInterfaceCount(), pythoncom._GetGatewayCount()))
except KeyboardInterrupt:
break
GIT.RevokeInterfaceFromGlobal(cookie)
del interp
del GIT
if __name__=='__main__':
test(BeginThreadsSimpleMarshal)
win32api.Sleep(500)
# Doing CoUninit here stop Pythoncom.dll hanging when DLLMain shuts-down the process
pythoncom.CoUninitialize()
if pythoncom._GetInterfaceCount()!=0 or pythoncom._GetGatewayCount()!=0:
print("Done with interfaces=%d, gateways=%d" % (pythoncom._GetInterfaceCount(), pythoncom._GetGatewayCount()))
else:
print("Done.")
开发者ID:tjguk,项目名称:pywin32,代码行数:29,代码来源:testGIT.py
示例11: AXDebugger
global currentDebugger
if currentDebugger is None:
currentDebugger = AXDebugger()
return currentDebugger
def Break():
_GetCurrentDebugger().Break()
brk = Break
set_trace = Break
def dosomethingelse():
a=2
b = "Hi there"
def dosomething():
a=1
b=2
dosomethingelse()
def test():
Break()
input("Waiting...")
dosomething()
print("Done")
if __name__=='__main__':
print("About to test the debugging interfaces!")
test()
print(" %d/%d com objects still alive" % (pythoncom._GetInterfaceCount(), pythoncom._GetGatewayCount()))
开发者ID:LPRD,项目名称:build_tools,代码行数:30,代码来源:debugger.py
示例12: _DoTestMarshal
def _DoTestMarshal(self, fn, bCoWait = 0):
#print "The main thread is %d" % (win32api.GetCurrentThreadId())
threads, events = fn(2)
numFinished = 0
while 1:
try:
if bCoWait:
rc = pythoncom.CoWaitForMultipleHandles(0, 2000, events)
else:
# Specifying "bWaitAll" here will wait for messages *and* all events
# (which is pretty useless)
rc = win32event.MsgWaitForMultipleObjects(events, 0, 2000, win32event.QS_ALLINPUT)
if rc >= win32event.WAIT_OBJECT_0 and rc < win32event.WAIT_OBJECT_0+len(events):
numFinished = numFinished + 1
if numFinished >= len(events):
break
elif rc==win32event.WAIT_OBJECT_0 + len(events): # a message
# This is critical - whole apartment model demo will hang.
pythoncom.PumpWaitingMessages()
else: # Timeout
print "Waiting for thread to stop with interfaces=%d, gateways=%d" % (pythoncom._GetInterfaceCount(), pythoncom._GetGatewayCount())
except KeyboardInterrupt:
break
for t in threads:
t.join(2)
self.failIf(t.isAlive(), "thread failed to stop!?")
threads = None # threads hold references to args
开发者ID:AT-GROUP,项目名称:AT-PLANNER,代码行数:27,代码来源:testMarshal.py
示例13: raw_input
# pyEngine2.AddCode(code)
# from win32com.axdebug import axdebug
# sessionProvider=pythoncom.CoCreateInstance(axdebug.CLSID_DefaultDebugSessionProvider,None,pythoncom.CLSCTX_ALL, axdebug.IID_IDebugSessionProvider)
# sessionProvider.StartDebugSession(None)
raw_input("Press enter to continue")
# forthEngine.Start()
pyEngine.Start() # Actually run the Python code
vbEngine.Start() # Actually run the VB code
except pythoncom.com_error, details:
print "Script failed: %s (0x%x)" % (details[1], details[0])
# Now run the code expected to fail!
# try:
# pyEngine2.Start() # Actually run the Python code that fails!
# print "Script code worked when it should have failed."
# except pythoncom.com_error:
# pass
site._Close()
if __name__ == '__main__':
import win32com.axdebug.util
try:
TestEngine()
except:
traceback.print_exc()
win32com.axdebug.util._dump_wrapped()
sys.exc_type = sys.exc_value = sys.exc_traceback = None
print pythoncom._GetInterfaceCount(),"com objects still alive"
开发者ID:hkfr,项目名称:data,代码行数:30,代码来源:testHost4Dbg.py
示例14: test
def test():
test_cxCpStockCur()
# test_cxCpFutureCode()
# test2()
print 'com reference count :', pythoncom._GetInterfaceCount()
开发者ID:ClarkOh,项目名称:snowball,代码行数:6,代码来源:cxCybosBase.py
示例15: sleep
# Minimize console window
if not gui and window[1]:
try:
win32gui.CloseWindow(window[1])
except:
traceback.print_exc(file=sys.stdout)
# Infinite loop
try:
if gui:
g.daemon = True
g.start()
while True:
sleep(1)
if doquit:
raise SystemExit()
except (KeyboardInterrupt, SystemExit) as e:
echo("")
echo("Ctrl-C quitting...")
echo("")
thread.doquit = True
sleep(1)
del thread # delete all references to the com object, otherwise iTunes won't close because of an open API connection
thread = None
sleep(1) # Wait so everything is really closed
if pythoncom._GetInterfaceCount() != 0:
echo("Not all references to the com object were cleared. %d references left." % pythoncom._GetInterfaceCount())
sleep(5)
pythoncom.CoUninitialize()
开发者ID:cvzi,项目名称:lfmsfiow,代码行数:30,代码来源:lfmsfiow.py
注:本文中的pythoncom._GetInterfaceCount函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论