I need to write one small application. Where i need to find all methods and properties of a activex control.
like,
1) Take CLSID or Prog ID
2) Find all methods
How to start in vc++,
Does anyone have the sample code or any docs
Thanks
AFAIK, you have to go directly to the registry to get a LIBID for a given CLSID (it's HKCR\CLSID\<CLSID>\TypeLib). For everything else there should be APIs. LoadRegTypeLib and CLSIDFromProgId are the other one to look for.
If you can instantiate the control or already have an instance, it likely implements IProvideClassInfo(2) via which you can obtain the ITypeInfo interface.
-hg
ITypeLibPtr tlb; ti->GetDocumentation(desc->memid, name.GetAddress(), doc.GetAddress(), &hepctx, help.GetAddress()); if(len > 1)
HRESULT hr = ::LoadTypeLib(L"C:\\Program Files\\Common Files\\microsoft shared\\OFFICE12\\MSO.DLL", &tlb);
for(UINT i = 0; i < tlb->GetTypeInfoCount(); i++)
{
ITypeInfoPtr ti = NULL;
tlb->GetTypeInfo(i, &ti);
TYPEATTR* attr = NULL;
ti->GetTypeAttr(&attr);
for(UINT j = 0; j<attr->cFuncs; j++)
{
FUNCDESC* desc = NULL;
ti->GetFuncDesc(j, &desc);
BSTR arr[100] = {0};
UINT len = 0;
ti->GetNames(desc->memid, &arr[0], 10, &len);
_bstr_t name, doc, help;
DWORD hepctx;
wprintf(L"\nName: %s\n", (LPCWSTR)name);
wprintf(L"Documentaction: %s\n", (LPCWSTR)doc);
wprintf(L"Help context: 0x%x\n", hepctx);
wprintf(L"Help File: %s\n", (LPCWSTR)help);
{
wprintf(L"\t%s params:\n", arr[0]);
SysFreeString(arr[0]);
for(UINT k = 1; k<len; k++)
{
wprintf(L"\t\tparam: %s\n", arr[k]);
SysFreeString(arr[k]) ;
}
}
ti->ReleaseFuncDesc(desc);
}
ti->ReleaseTypeAttr(attr);
But it can work event in VS6.
Some includes are missing.
#include <comdef.h>
{
wprintf(L"\t\tparam: %s (%d)\n", arr[k], desc->lprgelemdescParam[k-1].tdesc.vt);// Look for VARTYPE description
SysFreeString(arr[k]) ;
}
Everything works in my test space.
Function: InsertNodeBefore
Documentaction: (null)
Help context: 0x47c87
Help File: C:\Program Files\Common Files\microsoft shared\OFFICE12\
vbaof11.chm
InsertNodeBefore params:
param: Name (8) // VT_BSTR
param: NamespaceURI (8) // VT_BSTR
param: NodeType (29) //VT_USERDEFINED
param: NodeValue (8) // VT_BSTR
param: NextSibling (26) // VT_PTR
HRESULT InsertNodeBefore (
_bstr_t Name,
_bstr_t NamespaceURI,
enum MsoCustomXMLNodeType NodeType,
_bstr_t NodeValue,
struct CustomXMLNode * NextSibling );
So, show me your code of type dumping. May be there a bug.
Or you can send me your test set where it doesn't work. To my e-mail in profile.
Or research structures in code yourself.
Send your COM - control project by e-mail.