我是一名业余程序员,我计划支持一些清洁技术科学,这是我日常工作的一部分。如果我的问题模糊不清,我会提前道歉。
我正在尝试加载一个可以在VBA中成功加载的dll,但是我很难在python中完成它。这是VBA中的模块:
Public Declare Function Gwrite Lib "C:\Program Files\LQElectronics\UGSimple\UGSimpleAPI\LQUGSimple_s.dll" Alias "#100" (ByVal address As Integer, ByVal SCPI As String) As Integer
Public Declare Function Gread Lib "C:\Program Files\LQElectronics\UGSimple\UGSimpleAPI\LQUGSimple_s.dll" Alias "#101" (ByVal address As Long) As String
excel表中的代码看起来像这样
Sub CommandButton1_Click()
Dim proc As Integer
Dim result As String
proc = Gwrite(7, "*IDN?")
result = Gread(7)
MsgBox (result)
End Sub
上面的代码块工作得很好,但我想把它翻译成python。你能帮我么?非常感谢你阅读我的问题,我可以回答任何澄清。
答案 0 :(得分:0)
testlib = ctypes.CDLL('C:\Program Files(x86)\LQElectronics\UGSimple\UGSimpleAPI\LQUGSimple_c.dll')
testlib.Gwrite.restype = ctypes.c_int
testlib.Gread.restype = ctypes.c_char_p