Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DD_str方法在python2.x中可以用,python3.x中存在问题,只会输入字符串中第一个字符,就结束了 #57

Open
zxxwslq opened this issue Jul 20, 2022 · 4 comments

Comments

@zxxwslq
Copy link

zxxwslq commented Jul 20, 2022

如题,求解~~~

@zxxwslq
Copy link
Author

zxxwslq commented Jul 20, 2022

调用的是DD94687.64.dll这个驱动

@ddxoft
Copy link
Owner

ddxoft commented Jul 21, 2022 via email

@kvii
Copy link

kvii commented Mar 6, 2024

c_char_p(s.encode("ascii")) 解决了问题。下面是复现 demo:

from ctypes import *
import time

print("Load DD!")

dd_dll = windll.LoadLibrary("./dd.dll")
time.sleep(2)

st = dd_dll.DD_btn(0)  # DD Initialize
if st == 1:
    print("OK")
else:
    print("Error")
    exit(101)


def input_str(s: str):
    dd_dll.DD_str(c_char_p(s.encode("ascii")))


time.sleep(5)
input_str("Hello World!")

注意这个解决方案是我随便找的,可能有潜在的问题,我没仔细分析。文档链接

@ddxoft
Copy link
Owner

ddxoft commented Mar 6, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants