What does "THIS_" mean?
-
Hi The COM interfaces in my application derive from IUnknown. But some interface functions are declared using the "THIS_" parameter, some with "THIS" and some with none. For example:
1. STDMETHOD(DoBlah1) (THIS_ UINT uNum) PURE;
2. STDMETHOD(DoBlah2) (UINT uNum) PURE;- STDMETHOD(DoBlah3) (THIS_) PURE;
- STDMETHOD(DoBlah4) (THIS) PURE;
- STDMETHOD(DoBlah5) () PURE;
I would like to know whether the "THIS_" or "THIS" keywords are necessary, and what would be the difference between these functions. (I couldn't find the definitions of THIS or THIS_ in the VC browser or on the net...:~ )
Cheers d3m0n
-
Hi The COM interfaces in my application derive from IUnknown. But some interface functions are declared using the "THIS_" parameter, some with "THIS" and some with none. For example:
1. STDMETHOD(DoBlah1) (THIS_ UINT uNum) PURE;
2. STDMETHOD(DoBlah2) (UINT uNum) PURE;- STDMETHOD(DoBlah3) (THIS_) PURE;
- STDMETHOD(DoBlah4) (THIS) PURE;
- STDMETHOD(DoBlah5) () PURE;
I would like to know whether the "THIS_" or "THIS" keywords are necessary, and what would be the difference between these functions. (I couldn't find the definitions of THIS or THIS_ in the VC browser or on the net...:~ )
Cheers d3m0n
THIS_
,THIS
andPURE
are macros defined in basetyps.h and objbase.h. They are used for portability reasons with plain C, thus the code will compile with a C-compiler if written correctly. Have a look at Jeff Glatt's article serie about COM in plain C. You'll find the first article here[^]. You'll find the other parts, 2 to 8, in various chapters below the COM section here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown -
THIS_
,THIS
andPURE
are macros defined in basetyps.h and objbase.h. They are used for portability reasons with plain C, thus the code will compile with a C-compiler if written correctly. Have a look at Jeff Glatt's article serie about COM in plain C. You'll find the first article here[^]. You'll find the other parts, 2 to 8, in various chapters below the COM section here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown