VARIANT xmlSource,
VARIANT_BOOL *isSuccessful);

this is the call I wish to use on IXMLDOMDocument.

I call it as coinvoke psl, IXMLDOMDocument,load,pwsz,addr bla

where bla is just a DWORD.

yet it gives me this error
xml.asm(58) : error A2114: INVOKE argument type mismatch : argument : 2
coinvoke(16): Macro Called From
xml.asm(58): Main Line Code

I checked the definition and it's defined as IXMLDOMDocument_loadProto typedef proto IXMLDOMDocument_loadProto :DWORD,:VARIANT,:DWORD (generated by tlb2inc)

How come it expects 3? And why am I not getting 'too few arguments' errors?

it's probably something I'm not doing correctly with Ernie's CoLib package :-/

Any help is appreciated :)


Posted on 2002-02-03 06:44:52 by Hiroshimator
maybe this can be of some help
Posted on 2002-02-03 07:19:35 by Hiroshimator
First off, I've never used this stuff, so I can only comment generally.

2nd, IXMLDOMDocument_loadProto doesn't appear in my MSDN, so thats two strikes.

That being said from your post:

VARIANT xmlSource,
VARIANT_BOOL *isSuccessful);

is completely compatable with:


Here is why:

The first dword is the THIS pointer, which is assumed and left out of interface documentation.

The next one is a VARIANT structure, not a string. A variant might contain a string (actually it contains a bstr, which is a pointer to a lenght prefixed unicode string). That must be exactly that.

The third param is a pointer to a variant, thus typed DWORD. But make sure it IS a pointer to such, cause the routine will treat it as such, and step on the following bytes when returning even a zero.

So you have exactly the correct count of params, just a typedef error. You need to make a couple variants to keep it completely happy.

Somewhere in CoLib variants are defined, so you can just do:

MyVariant VARIANT {}

then use the variant API to fill in the structure. DO FILL IT IN, even for the return value pointer (I'd first make it a BOOL with a value of FALSE).
Posted on 2002-02-03 08:14:23 by Ernie
I've been looking at it more and BSTR handling is really hard it seems (at least it is for me right now :grin: )

thx for your explanation, it helped a lot
Posted on 2002-02-07 08:18:18 by Hiroshimator
Hiro, I find them more annoying than hard to handle. But Agreed they are not fun! I spent a good deal of my time a year ago over this issue (and with Ernie' guidence) and i can't say i have em mastered as of yet... I just try to avoid them when i can..

I feel your pain :)

BTW: Ernie released a BSTR lib around the same time, it may be of some use to you (not sure if its in the masm v7 tho?).

Posted on 2002-02-07 09:10:40 by NaN
No, it's not in MASM32, CoLib wasn't upgraded in the new release, you have to pull it off my site.

BSTR's are more of a hassle then a problem. If there was an API for "take this ascii string and give me a BSTR" it would be lots easier.

But that's not so hard to do, so just bang one out. It's not difficult, and it is gopod practice.

Just remember a BSTR is not a string, it is a POINTER to a string.
Posted on 2002-02-08 18:33:12 by Ernie
Afternoon, All.

Please excuse the resurrection of this thread (which is over two years old :tongue: ).

I was looking into how to use XML DOM object for loading/ reading xml documents and stumbled across this thread where harold had already built the file.

After a bit more searching/ reading/ etc I've been able to adjust Harold's code so that it works.

Note that there's practically no comments (if any ;) ) so you might find it easier to have a look at the "\Program Files\Microsoft Platform SDK\Samples\Web\xml\c++_samples" example if you've got it.

I'm working on something a little bit clearer however I thought I'd chuck what I've done up here for any comments.

Posted on 2004-05-25 08:08:04 by Scronty
Greetings All,
VARIANT_BOOLs are WORDS not DWORDs, so the original code fragment would have compiled if you were to have instantiated bla as a WORD.

I also developed some XSL/XML code awhile ago, hopefully this will serve
as useful example code:
Posted on 2004-05-27 21:57:04 by Poimander
I'm presenting an updated version of tlixml. The code now employs UrlCreateFromPath removing the dependence upon the particular UNC path of the generated HTML file. The ShowHTML routine is also improved.
Posted on 2004-06-02 19:08:08 by Poimander