No, I meant the structure you would be getting if you were calling the method directly using WinAPI's COM API. I just can't say it more clearly. Or just dump the byte array to the console in ascii, see what is there and try to guess its stucture.
No, I meant the structure you would be getting if you were calling the method directly using WinAPI's COM API. I just can't say it more clearly. Or just dump the byte array to the console in ascii, see what is there and try to guess its stucture.
If I can try to put it a bit more clearly:
Your dynamic call returns a QByteArray with 441 elements right? So all those return types (CardID, OverWrite, idxDesignation and all those) you listed should be contained in those 441 elements.
What wysota means by structure is how those 441 elements are divided to produce the return types ie. CardID is a string of size 10, OverWrite a byte(or bit) etc... If you have that structure you can try to cast the QByteArray to that structure. Otherwise you'll need to determine the structure as wysota mentioned - by dumping to ascii and trying to figure out the type of each return type.
That depends on the lifetime you expect the object (m_treeView in my example) to have. On the stack is fine for a short lifespan limited by scope, on the heap would be more typical. The code generated by dumpcpp connects to COM control at the time the wrapper object is constructed and doesn't care how the object came to be.
You have had success with dumpcpp creating some wrappers. The generated classes should manage marshalling COM response into qt and/or C++ structures for you make for more direct access (adjust names as needed):
If you dig around in the generated H and CPP file you might find a definition of "ArrayList" (or it may be intended to be an opaque blob although this seems unlikely). You may also find references to a Windows help file that matches the type library.Qt Code:
#include "generated_header.h" ... terminalLib::oTerminal *comObject; comObject = new terminalLib::oTerminal(this); delete comObject;To copy to clipboard, switch view to plain text mode
Could you post (attach) the generated header file?
If the QVariant returned is of type QByteArray then the COM return was a SAFEARRAY(BYTE) according to the QAxBase documentation.
You might find this useful:
http://www.roblocher.com/whitepapers/oletypes.aspx
http://msdn.microsoft.com/en-us/libr...ROT.13%29.aspx
Compress them. Then you will be able to attach them to your post. And only send the relevant file (.h).
Wysota I saw some data calling the routine in a C# console application and I had to do a conversion byte to ascii to see something.
I think if for that that I can not see nothing in Qt. How can I convert the bytearray in ascii?
I also saw that the stream of data contains lots of '\0' and for that maybe I can not see well all characters.
Best
Last edited by franco.amato; 21st April 2010 at 20:31.
This is was I already did many times
This is the result of the routine call in a cmd line app written in C#:I can tell you that Qt doesn't "manage" null bytes in any way. They are bytes like any other.
You can see many '\0' but why debuggind with visual studio my Qt app I can not see the same string that's should contained in the QByteArray? And also I really don't understand which characteres are these: ??"I??\0\0xml;q=0.Franco\0\0\0\0\0\0\0\0\0Amato\0\0 \0\0\0\0\0\0\0\0\0\0\0\0AAAAAAAAAAAAAAA=0\0\n \n0987654321`E?\"UF ??\fCQ????O\"D ?\v2??(E??\n2F?D?\fH1\b\vH???\nIae?.???(?`>?/?p<?;M???????:????\"8??`:?!???PQ?\r??`'?`2 ??Q)\n??#3?????#34????\"34????\"34O???\"34O? ??\"#3D???#4D???#4D???#4D???34D???\"3DD? ??#DDE???4DTE???4UUEo??EUUUo???VffUo???ffff?? ?wwff????wwvg?\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0"
I hope you can help me
Franco Amato
You still seem to be expecting a nice human readable string when what you are being passed is a binary data structure. The docs for the COM server say it returns an ArrayList (a .Net/C# data type of some sort) but this has to be translated to something that can be sent through the COM interface, which must remain language agnostic. The QAxBase docs imply this structure is a SAFEARRAY(BYTE). I'd hazard a guess it's a single dimensional array of VT_VARIANT entries.
In your C++ Qt application you receive a QByteArray. Use QByteArray::toHex() to dump the first 24 or 32 bytes. Then sit and try to marry the bytes to the SAFEARRAY structures described here;
http://msdn.microsoft.com/en-us/library/aa913233.aspx
Does the number of dimensions make sense? Do the array bounds make sense? If so, read here:Qt Code:
typedef struct FARSTRUCT tagSAFEARRAY { unsigned short cDims; // two bytes unsigned short fFeatures; // two bytes unsigned short cbElements; //two bytes unsigned short cLocks; // two bytes unsigned long handle; // four bytes void HUGEP* pvData; // four bytes SAFEARRAYBOUND rgsabound[1]; // structure below repeated if more than one dimension in array } SAFEARRAY; typedef struct tagSAFEARRAYBOUND { unsigned long cElements; // four bytes long lLbound; // four bytes } SAFEARRAYBOUND;To copy to clipboard, switch view to plain text mode
http://msdn.microsoft.com/en-us/library/ms221145.aspx
You might want to use your favourite search engine to look for a C++ wrapper for SAFEARRAYs.
Then do it again and again until you find something you consider useful for writing a routine for dumping the byte array in ascii (or hex or whatever you find important). I can already tell you there is no method in QByteArray that will do the task for you - you have to come up with a proper algorithm yourself. Otherwise you won't learn anything and next time you will again ask someone for help instead of trying to solve the problem on your own first.
Bookmarks