I'm trying to write a very simple controller for a camera on a WinXP machine. Instead of writing c code, I thought I would simply use ctypes to access the dll.
To start the camera, you have to call:
BeginHVDevice(int nDevice, HHV *pHandle)
*pHandle is a pointer to a camera handle, which in the.h file is simply defined as
typedef HANDLE HHV;
I had thought that the following should work
from ctypes import *
from ctypes.wintypes import *
ailt_lib = cdll.LoadLibrary("HVDAILT")
load_camera = ailt_lib.BeginHVDevice
load_camera.restype = c_int
load_camera.argtypes = [c_int, POINTER(HANDLE)]
def initDev(res=(800,600)):
cam_int = c_int(1)
cam_handle_type = POINTER(HANDLE)
print cam_handle_type
cam_handle = cam_handle_type()
print cam_handle
cam_stat = load_camera(cam_int, cam_handle )
print cam_stat
return cam_handle
but, when I call initDev(), I get a ValueError: Procedure called with not enough arguments (8 bytes missing) or wrong calling convention. I'm pretty sure this means that I have not produced a compatible pointer to pass, but I can't figure out what the function actually wants to receive.
I've spent a couple of days search stackoverflow, looking at ctypes documentation and trying all sorts of permutations, but I have not found the answer.