-
January 17th, 2007, 02:26 PM
#1
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
-
January 17th, 2007, 03:26 PM
#2
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
-
January 17th, 2007, 05:52 PM
#3
Re: Accessing ActiveX Methods from MMC Snap-in
here you can find some useful samples of how to invoke COM object methods dynamically
Cheers,
Alex
Please rate this post if you find it helpful
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|