PDA

View Full Version : QVariant of 'Type.Missing'



semajnosnibor
17th January 2012, 20:01
In regards to ActiveQT, is there a way of making a QVariant that would be the equivalent of the following VARIANT:

VARIANT v;
v.vt = VT_ERROR;
v.scode = DISP_E_PARAMNOTFOUND;

I've tried to convert the VARIANT to QVariant, using: VARIANTToQVariant(), however I can not compile the code. Specifically to use VARIANT I included "windows.h" (or "qt_windows.h") and to get the VARIANTToQVariant() I included "qaxtypes.h". As soon as I have both of those, I get the following compile errors:

c:\Qt\2010.05\qt\lib/libqaxserver.a(qaxservermain.o):qaxservermain.cpp: (.text+0x478): multiple definition of `WinMain@16'

c:\Qt\2010.05\qt\lib/libqtmaind.a(qtmain_win.o):C:\qt-greenhouse\Trolltech\Code_less_create_more\Trollte ch\Code_less_create_more\Troll\4.6\qt\src\winmain/../../include/QtCore/../../src/corelib/global/qglobal.h:1381: first defined here

c:\Qt\2010.05\qt\lib/libqaxserver.a(qaxserver.o):qaxserver.cpp:(.text+0 xe01): undefined reference to `qax_instantiate()'

Added after 1 19 minutes:

Further info:
Tried creating an invalid QVariant() and putting the value (DISP_E_PARAMNOTFOUND) in. From looking at QAx code that seems to be the way to go, however, QAxObject still throws up an error when this QVariant is used.

wysota
17th January 2012, 23:28
I think you included some file you shouldn't have included and you have two WinMain() functions now.

semajnosnibor
19th January 2012, 06:42
Not sure what the would have been, but regardless, after looking at the code for VARIANTtoQVariant() it doesn't look like it would handle the case of a variant with the .VT = VT_ERROR and the .SCODE = DISP_E_PARAMNOTFOUND. It's interesting though that the QVariantToVARIANT() converts a QVariant::Invalid to a similar VARIANT (though the LVAL is set to DISP_E_PARAMNOTFOUND, and not the SCODE).
I have tried passing an invalid QVariant(), but no joy.
Is it actually possible that no one has used ActiveQT with any COM functions requiring these 'Type.Missing' VARIANTS?

wysota
19th January 2012, 09:42
Anything is possible :)