Modified TypeLib Add-In.
I think that those IUnknown methods was at wrong place.
BufCat(pOut, _T("\t// IUnknown methods\n"));
BufCat(pOut, _T("\tSTDMETHOD(QueryInterface)(THIS,REFIID,void**);\n"));
BufCat(pOut, _T("\tSTDMETHOD_(ULONG,AddRef)(THIS);\n"));
BufCat(pOut, _T("\tSTDMETHOD_(ULONG,Release)(THIS);\n"));
if (fDispatch)
{
BufCat(pOut, _T("\t// IDispatch methods\n"));
BufCat(pOut, _T("\tSTDMETHOD(GetTypeInfoCount)(THIS,UINT*);\n"));
BufCat(pOut, _T("\tSTDMETHOD(GetTypeInfo)(THIS,UINT,LCID,ITypeInfo**);\n"));
BufCat(pOut, _T("\tSTDMETHOD(GetIDsOfNames)(THIS,REFIID,LPOLESTR*,UINT,LCID,DISPID*);\n"));
BufCat(pOut, _T("\tSTDMETHOD(Invoke)(THIS,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);\n"));
}
BufCat(pOut, _T("\t// %ls methods\n"), pwszTypeName);
EDIT 20121129 Fixed THIS