Accessing ActiveX Methods from MMC Snap-in
Hi ...
I have a ActiveX Control and I'm using it in a MMC Snap-in. This is my first time. I have some sample code that shows how to access the properties from the snap-in. I have shown this code below.
Code:
switch (event)
{
case MMCN_INITOCX:
{
// Use ATLs IDispatch helper class to access ActiveX Properties
CComDispatchDriver spStatus = LPUNKNOWN(param);
// Set the TestValue value in ActiveX Control
spStatus.PutPropertyByName(L"TestValue", &CComVariant(7));
}
break;
}
So ... I have a method in the ActiveX Control and would like to execute it ... For example the About box or the PropertySheet or in my case a simple method called Beep() that will make a sound.
Thanks,
Chris
Re: Accessing ActiveX Methods from MMC Snap-in
He again ...
I have tryed this and it does not seem to all the method ???
I will try to look further.
Code:
HRESULT hresult;
IDispatch FAR* pdisp = (IDispatch FAR*)NULL;
DISPID dispid;
OLECHAR FAR* szMember = L"BeepSound2";
hresult = spStatus.p->GetIDsOfNames(IID_NULL,
&szMember,
1,
LOCALE_SYSTEM_DEFAULT,
&dispid);
spStatus.p->Invoke(dispid,
IID_NULL,
LOCALE_USER_DEFAULT,
DISPATCH_METHOD,
NULL,
NULL,
NULL,
NULL);
Thanks,
Chris
Re: Accessing ActiveX Methods from MMC Snap-in
here you can find some useful samples of how to invoke COM object methods dynamically