Problem: meet problem with getting the return value by calling COM methods
-
I am playing with AXIS network camera using its SDK, it’s free. I want to use its GetCurrentImage function to get the Image.
Below is the syntax of GetCurrentImage from AXIS SDK.
GetCurrentImage
Syntax
@ HRESULT GetCurrentImage(int theFormat, [C++] VARIANT* theBuffer, LONG* theBufferSize );@
Parameters
theFormat
Identifier specifiying the format of the image data. Values available are: 0 = JPEG, 1 = BMP (defined in the AMC_IMAGE_FORMAT enum in the type library).theBuffer
The buffer where the image data is returned.theBufferSize
Size of the image data buffer returned.It looks like assigning the “theBuffer” field passing by reference, like the format below
@
var* var;getCurrentImage(var){ // object-> dynamicallcall(“getCurrentImage(var)”)
var = … // which can not be seen by us, because I am using dynamiccall to call the method in AXIS SDK
}
@I am trying to use ActiveQt framework to call method of that COM to set the value of two local variables (1) QVariants* MediaBuffer; (2) LONG* MediaBufferSize;
At the first time, I tried to use
@dynamiccall ( const char * function, QList<QVariant> & vars )@to let this COM method to return and assign those two values
but I double checked the document, It seems that this function only can set value to the COM function, it will report@QAxBase: Error calling IDispatch member GetCurrentImage: Type mismatch in parameter 2@
if I want to get the returned value by this method callingSo now I suspect whether I can try to use methods like these
@
QString text = object.property("text").toString();
object.setProperty("font", QFont("Times New Roman", 12));
@to try to assign the values to my two local variables
but the hard point is this GetCurrentImage method return two parameters at the same time, then I have no idea how to assign my two local variables now based on the example provided by the Qt class reference
Do you guys have any suggestions on that situation?
I filed my code and share it on github in the link below
https://github.com/szysagittarius/AxisGetCurrentImageUsingQtexcept the getCurrentImage function can not work properly, other functions works fine.
If you guys have interest, you can play with this code after installing the AXIS Media Control sdk, which only need few second to install them
below is the address of AXIS Media Control sdk,
http://www.axis.com/techsup/cam_servers/dev/activex.htmthe function document is under the doc in the installing directory (..\AXIS Media Control SDK\doc)
Thanks ahead,
Best regards