In [25]:
import ctypes
import os

In [26]:
os.chdir('C:\Program Files\Thorlabs\Kinesis')

In [27]:
lib = ctypes.windll.LoadLibrary(r'C:\Program Files\Thorlabs\Kinesis\ThorLabs.MotionControl.KCube.StrainGauge.dll')

In [28]:
lib.TLI_BuildDeviceList()


Out[28]:
0

In [29]:
nDev = lib.TLI_GetDeviceListSize()

In [33]:
devID = 59
TL_cBufSize = 255
sBuf = ctypes.c_buffer(TL_cBufSize)
if lib.TLI_GetDeviceListByTypeExt(sBuf, TL_cBufSize, devID) != 0:
    print("ERROR", "No devices of type {0} found".format(devID))

In [34]:
sBuf


Out[34]:
<ctypes.c_char_Array_255 object at 0x000000000BCC8548>

In [35]:
serNr        = 59000019
serNrStr= ctypes.c_char_p(serNr.__str__().encode("ascii"))

serNrStrList = sBuf.value.decode().rsplit(",")[0:-1]
if not(serNr.__str__() in serNrStrList):
    print("ERROR", "No device with S/N {0} found".format(serNr))

In [ ]: