• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pythoncom._GetGatewayCount函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pythoncom._GetGatewayCount函数的典型用法代码示例。如果您正苦于以下问题:Python _GetGatewayCount函数的具体用法?Python _GetGatewayCount怎么用?Python _GetGatewayCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了_GetGatewayCount函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: 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


示例2: 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


示例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: 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


示例5: __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


示例6: 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


示例7: 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


示例8: 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


示例9: 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


示例10: 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


示例11: _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



注:本文中的pythoncom._GetGatewayCount函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pythoncom._GetInterfaceCount函数代码示例发布时间:2022-05-27
下一篇:
Python util.Subprocess类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap