LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Why didnt' the ActiveX controller wizzard create a function to get CAObjHandle from interface

I used the Create ActiveX Controller Wizzard and a lot of the functions from the server were created.  However, I get to one part and it requires a handle for an interface/struct that it stuffs status data into.  I can see all of the compnents in the .c file, but no function was returned to create the handle.  Why?

0 Kudos
Message 1 of 7
(3,957 Views)

Hello rwmahar

 

Can you provide us more info about what are you doing?

 

Regards

 

Mart G

0 Kudos
Message 2 of 7
(3,934 Views)

Sorry,

 

I think I didn't quite understand what was going on in the original post.  I still don't, but feel like I'm a bit closer.  I used the create activex controller wizzard and code generator to start on a client application for an existing activex control.  Everything was working fine, then I came to the first part where the COM object needs to stuff data into a structure that was defined when I ran the wizzard and code generator.  So, where I'm stuck is, I know I'm supposed to pass the structure to function based on documentation that came with the activex server.  however, the generated function is requesting a CAObjHandle to the structure.  So, I had created my CAObjHandle, but it's just initialized to 0.  The function wants a handle to the structure and there is no function created to get it that I can see.

0 Kudos
Message 3 of 7
(3,921 Views)

This is the call and function.  Where detectStatusx is typedef CAObjHandle FLASHSERVERLibObj_IFlashDetectStatus;

 

HRESULTx = FLASHSERVERLib_IFlashStartDetect (flashx, &Error, 1, &dataLink[0], 1, 1, detectStatusx);

 

 

HRESULT CVIFUNC FLASHSERVERLib_IFlashStartDetect (CAObjHandle objectHandle,
                                                  ERRORINFO *errorInfo,
                                                  long numDataLinks,
                                                  enum FLASHSERVERLibEnum_T_FLASH_DATALINK *pDataLinks,
                                                  long enterFlashMode,
                                                  long singleDetect,
                                                  FLASHSERVERLibObj_IFlashDetectStatus pStatus) // added *
{
 HRESULT __result = S_OK;
 FLASHSERVERLib_IFlash_Interface * __vtblIFacePtr = 0;
 int __didAddRef;
 int __errorInfoPresent = 0;
 LPUNKNOWN pStatus__AutoType = 0;

 if (pStatus)      
  {
  __caErrChk (CA_GetInterfaceFromObjHandle (pStatus,  // added *
                                           &FLASHSERVERLib_IID_IFlashDetectStatus,
                                           1, &pStatus__AutoType, NULL));
  }

 __caErrChk (CA_GetInterfaceFromObjHandle (objectHandle,
                                           &FLASHSERVERLib_IID_IFlash, 0,
                                           &__vtblIFacePtr, &__didAddRef));
 __caErrChk (__vtblIFacePtr->lpVtbl->StartDetect_ (__vtblIFacePtr,
                                                   numDataLinks,
                                                   (long *)pDataLinks,
                                                   enterFlashMode,
                                                   singleDetect,
                                                   pStatus__AutoType));

Error:
 if (pStatus__AutoType)
  pStatus__AutoType->lpVtbl->Release (pStatus__AutoType);
 if (__vtblIFacePtr && __didAddRef)
  __vtblIFacePtr->lpVtbl->Release (__vtblIFacePtr);
 CA_FillErrorInfoEx (objectHandle, &FLASHSERVERLib_IID_IFlash, __result,
                     errorInfo, &__errorInfoPresent);
 if (__errorInfoPresent)
  __result = DISP_E_EXCEPTION;
 return __result;
}

0 Kudos
Message 4 of 7
(3,910 Views)

Okay, further clarification.  I looked at some examples and they indicate CVI ActiveX Control Wizard should've created a class of Event Callback Registration Functions.  Are there cases when this may not happen.  In the documentation with the ActiveX control this should be a callback.  However, I'm not sure if CVI should've created the callback or if I need to do this?  If so, what CVI functions would I need?  In some of the on line documentation it indicates the RunUserInterface() handles these events and passes the relevant once to the panel, how does it know what callbacks need to be executed by the client application I'm trying to code?

0 Kudos
Message 5 of 7
(3,887 Views)

Hello Rwmahar

 

I will be escalating your questions internally and let you know. Sorry for not having an answer right away.

 

Best regards

 

Mart G

0 Kudos
Message 6 of 7
(3,875 Views)

Mart,

 

 For clarification, the function created by the wizard requires a Handle to the interface, but does not have a function to create the interface and return a handle.   The server documentation indicates the client program should create the object, which it looks like it did through some data structures.  However, again, I don't really know how to get a handle for it.

 

Thanks for you help.

 

rwm

0 Kudos
Message 7 of 7
(3,871 Views)