I´m trying to use a xv2003.ocx of CFTV board with labwindows.
I did the activex control, but I have a doubt in a function OpenSlot.
As a code:
#include <cvirte.h>
#include <userint.h>
#include <windows.h>
#include "XV2003.h"
#include "TESTE.h"
static int panelHandle;
int status, error;
short int dev, slot;
static CAObjHandle obj;
static CAObjHandle pic;
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "TESTE.uir", PANEL)) < 0)
return -1;
CA_InitActiveXThreadStyleForCurrentThread (0, COINIT_APARTMENTTHREADED);
SetCtrlVal(panelHandle, PANEL_LED, 0);
DisplayPanel (panelHandle);
RunUserInterface ();
if (!obj)
{
CA_DiscardObjHandle (obj);
obj = 0;
}
DiscardPanel (panelHandle);
return 0;
}
int CVICALLBACK sair (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
XV2003Lib__DXv2003Stop (obj, NULL);
XV2003Lib__DXv2003CloseVideo (obj, NULL, dev);
XV2003Lib__DXv2003CloseSlot (obj, NULL, slot);
CA_DiscardObjHandle (obj);
obj = 0;
QuitUserInterface (0);
break;
}
return 0;
}
int CVICALLBACK liga (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
short int t, ncard, vid, chan, idchan,id, pn, res;
long cp, img;
switch (event)
{
case EVENT_COMMIT:
status = GetObjHandleFromActiveXCtrl (panelHandle, PANEL_XV2003, &obj);
status = SFILELib__DSfileDeinit (pic, NULL);
status = XV2003Lib__DXv2003Init (obj, NULL);
status = XV2003Lib__DXv2003GetTotalSlot (obj, NULL, &slot);
status = XV2003Lib__DXv2003GetDeviceNum (obj, NULL, slot, &dev);
status = XV2003Lib__DXv2003CreateVideo (obj, NULL, dev, 230, 340);
status = XV2003Lib__DXv2003OpenSlot (obj, NULL, slot, long H_Wnd);
status = XV2003Lib__DXv2003GetTotalCard (obj, NULL, &ncard);
status = XV2003Lib__DXv2003IsVidPresent (obj, NULL, slot, &vid);
status = XV2003Lib__DXv2003GetDevID (obj, NULL, slot, &id);
status = XV2003Lib__DXv2003GetChnID (obj, NULL, slot, &idchan);
status = XV2003Lib__DXv2003GetChannelNum (obj, NULL, dev, &chan);
status = XV2003Lib__DXv2003Run (obj, NULL, dev);
break;
}
return 0;
}
Answers of variables:
obj = 41762400
slot = 0
dev = 0
ncard = 1
vid = 1
id = 0
idchan = 0
chan = 2
In my opinion the value of variables indicate that the board is working.
The parameters of OpenSlot function is :
HESULT XV2003Lib__DXv2003OpenSlot (CAObjHandle ObjectHandle , ERRORINFO *Error_info, short N_Slot, long H_Wnd);
I think that with this function the image will show on the screen and but I don't know what to do with the parameter " long H_Wnd"
I'd like to know if someone can help me capture the image and put it on the screen.
tks
Andre G.