Reputation: 73
For example, there is a function named CreateFrame like,
virtual STDMETHODIMP CreateFrame(THIS_ LPCSTR Name,
LPD3DXFRAME*ppNewFrame);
I think STDMETHODIMP means It will return HResult and stdcall function, but I don't know what THIS_ in argument menas.
THIS_ is defined in combaseapi.h like this.
#define PURE = 0
#define THIS_
#define THIS void
For more information, the function 'CreateFrame ' is called automatically when D3DXLoadMeshHierarchyFromX is called.
Upvotes: 0
Views: 383
Reputation: 41047
Those are just old-school COM macros. Don't worry about them, especially since you are looking at the deprecated D3DX header for legacy Direct3D 9 from 13+ years ago...
virtual STDMETHODIMP Func(THIS);
This is a function that takes ONE parameter: the implicit this
pointer, returns an HRESULT
, and is annotated for proper COM calling convention __stdcall
.
virtual STDMETHODIMP Func(THIS_ LPCSTR Name, LPD3DXFRAME*ppNewFrame);
This is a function that takes THREE parameters: the implicit this
pointer, a pointer to a string, and a pointer to a specific object), returns an HRESULT
, and is annotated for proper COM calling convention.
To declare a function that returns a type other than HRESULT
you'd use STDMETHOD_
:
virtual STDMETHOD_(ULONG, Func) (THIS_ LPCSTR Name, LPD3DXFRAME*ppNewFrame);
These old headers often also supported use from C rather than C++, where this
is not implicit. Legacy D3DX never bothered with the C call-paths, but many old system headers did use them. In fact, if you did a little further in combaseapi.h
you'll see the C language section defines THIS_
and THIS
as:
#define PURE
#define THIS_ INTERFACE FAR* This,
#define THIS INTERFACE FAR* This
The more modern MIDL compiler generates code that's slightly less confusing:
virtual HRESULT STDMETHODCALLTYPE Func(void);
or
virtual void STDMETHODCALLTYPE Func(UINT value, LPCWSTR name);
Upvotes: 0