如何在 Python 中调用 initializeAccessBridge?

问题描述

我尝试在Python中导入windowsaccessbridge-64.dll,当调用函数initializeAccessBridge时,提示找不到,下面的代码如何修改

import  ctypes as a
b = a.windll.LoadLibrary(r"C:\XXX\windowsaccessbridge-64.dll")
print(b.isJavaWindow)                   #<_FuncPtr object at 0x000001C6XXX>
print(b.Windows_run)                    #<_FuncPtr object at 0x000001C6XXX>
print(b.shutdownAccessBridge)   #not found
print(b.initializeAccessBridge)         # not found

代码修改如下,AccessBridgeCalls.so 被编译并创建了一个消息泵循环,在这个循环中 flag = So_accessbridge.initializeAccessBridge() 总是返回 0,所以下面的代码 while user32.GetMessageA(ctypes.byref(msg),None,0) 不起作用,任何人都可以帮助我它吗?

import  ctypes
import  ctypes.wintypes
#from threading import Thread
import threading
user32 = ctypes.windll.user32

Dll_accessbridge = ctypes.windll.LoadLibrary(r"C:\XXX\windowsaccessbridge-64.dll")
So_accessbridge = ctypes.windll.LoadLibrary(r"C:\XXX\AccessBridgeCalls.so")

class MyThread(threading.Thread):
    def run(self):
        msg = ctypes.wintypes.MSG()
        flag = So_accessbridge.initializeAccessBridge()
        print('flag = ' + str(flag)) #flag = 0
        while user32.GetMessageA(ctypes.byref(msg),0):
            print('n')
            user32.TranslateMessageA(msg)
            print('p')
            user32.dispatchMessageA(msg)
        print('q')

t = MyThread()
t.start()

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)