PCDVD數位科技討論區

PCDVD數位科技討論區 (https://www.pcdvd.com.tw/index.php)
-   七嘴八舌異言堂 (https://www.pcdvd.com.tw/forumdisplay.php?f=12)
-   -   python ctypes調用dll問題 (https://www.pcdvd.com.tw/showthread.php?t=1078890)

waynezen 2015-05-25 09:20 PM

python ctypes調用dll問題
 
1個附加檔案
小弟非資工本科,還請各位先進多指教

工作上自學python最近在讀一組RFID機器所碰到的問題

protocol


送出命令的部分都沒問題,都Return 0成功

==============================
from ctypes import *

dll = windll.LoadLibrary("MasterRD.dll")

port = 1
baud = 19200
icdev = 0
msec = 10
color = 2
type = 0x41
model = 0x52
bcnt = 4

rf_init_com = dll.rf_init_com(port,baud)
rf_beep = dll.rf_beep(icdev,msec)
rf_ligh = dll.rf_light(icdev,color)
rf_init_type = dll.rf_init_type(icdev,type)
rf_request = dll.rf_request(icdev,model,byref(i))
print i

==============================

我該如何利用byref讀取*pTagType回應值呢?

dkjfso 2015-05-25 09:32 PM

我沒學過python
但看起來byref(i)已經把i的引用傳給rf_request了
如果函數返回0成功的話
i本身就是pTagType的值了
不就讀到了嗎?
print i 也把它顯示出來了?


所有的時間均為GMT +8。 現在的時間是06:06 PM.

vBulletin Version 3.0.1
powered_by_vbulletin 2025。