Click here to Skip to main content
15,901,035 members
Home / Discussions / COM
   

COM

 
GeneralDCOM VB Active X Control in MFC fails but works when hosted in VB Pin
quannum13-Jan-03 23:23
quannum13-Jan-03 23:23 
GeneralLicense Control!!! Pin
akelasher13-Jan-03 11:49
akelasher13-Jan-03 11:49 
GeneralBest method for implementing IEnumXXXX Pin
Heath Stewart12-Jan-03 19:19
protectorHeath Stewart12-Jan-03 19:19 
GeneralDynamic COM Server Use Pin
Anonymous10-Jan-03 12:29
Anonymous10-Jan-03 12:29 
GeneralRe: Dynamic COM Server Use Pin
geo_m10-Jan-03 21:29
geo_m10-Jan-03 21:29 
GeneralRe: Dynamic COM Server Use Pin
Anonymous12-Jan-03 1:42
Anonymous12-Jan-03 1:42 
GeneralRe: Dynamic COM Server Use Pin
geo_m12-Jan-03 3:07
geo_m12-Jan-03 3:07 
GeneralRe: Dynamic COM Server Use Pin
thowra13-Jan-03 13:23
thowra13-Jan-03 13:23 
Finally got my login from my other machine (I hate posting anonymously)! Glad to meet you Geo, phykell here! Smile | :)

OK, what I decided to do was have my browser client (EffectBrowser), and have a separate server, "Effects", to hold the IEffect interface (same as "IPlugin" in your example) and make it available to all plugins and the browser of course.

I created an ATL server and defined a new class as an "ATL Class". The class name is "Effect", the interface type is "custom" and there's a single interface associated with it, "IEffect". I then added a method to the interface, "GetName", returning me a *BSTR. That project builds with no problems, registers and gives me a type library "Effects.tlb"

So, I then create my plugin as an ATL server, "EffectServerMosaic". I add a new ATL class with the name "EffectMosaic". It has a custom interface called "IEffectMosaic". I then import the Effects.tlb into the EffectServerMosaic.idl file and I change the EffectMosaic coclass' default interface to "IEffect" (defined in my imported type library). I then add a category map to my EffectMosaic coclass. My ATL server builds and registers successfully.

Note at this point, I haven't implemented a method GetName() for my plugin which I guess is necessary to over-ride the one provided by my plugin's coclass' default interface "IEffect". Is that right because if so, how come the compiler hasn't generated an error *requiring* me to provide an implementation?

So far so good (I think) Smile | :)

Finally I create my EffectBrowser application. I place the necessary code to get a list of all coclasses with the required category map and I prove this by displaying the retrieved ProgIDs derived from the CLSIDs (I presume these CLSIDs/ProgIDs are of each coclass). For example, one ProgID I get is displayed as:

EffectServerMosaic.EffectMosaic.1

I then try and create an instance of one of these coclasses (so that I can try and call the GetName() method on them. Unfortunately, I get an error message "REGDB_E_CLASSNOTREG" class not registered.

Here's the code I use to try and create the instance:

CLSID myCLSID = clsid[0];<br />
IEffect *pMyEffect = NULL;<br />
hr = CoCreateInstance(myCLSID, NULL, CLSCTX_ALL, IID_IEffect, (void **)&pMyEffect);


Note that IEffect and IID_IEffect are pulled in from the following #includes:

#include "..\Effects\Effects_i.c"	<br />
#include "..\Effects\Effects.h"


Clearly, if I'd tried to create an instance using a pointer to the IEffectMosaic interface and the IID_IEffectMosaic ID, it would've have succeeded. I thought I'd be able to call the plugin's methods by getting its ProgID and using it's default interface or do you think I've made a fundamental mistake somewhere (I certainly do!)...

Lastly, I didn't understand what you meant when you said "need to generate the C++ part" and what you meant when you recommended using the #import diective.

Thanks again for your help, and sorry this is taking so long Smile | :)

"The folly of man is that he dreams of what he can never achieve rather than dream of what he can."
GeneralRe: Dynamic COM Server Use Pin
geo_m13-Jan-03 21:33
geo_m13-Jan-03 21:33 
GeneralRe: Dynamic COM Server Use Pin
thowra14-Jan-03 8:24
thowra14-Jan-03 8:24 
GeneralCOM Interface Name Clashes Pin
Anonymous10-Jan-03 7:08
Anonymous10-Jan-03 7:08 
GeneralRe: COM Interface Name Clashes Pin
geo_m10-Jan-03 21:51
geo_m10-Jan-03 21:51 
GeneralRe: COM Interface Name Clashes Pin
Anonymous12-Jan-03 1:12
Anonymous12-Jan-03 1:12 
GeneralRe: COM Interface Name Clashes Pin
geo_m12-Jan-03 3:19
geo_m12-Jan-03 3:19 
GeneralDear ERIK!!!!!!!!!!Please..... Pin
vcarivu10-Jan-03 0:53
vcarivu10-Jan-03 0:53 
GeneralPluging ActiveXContol in I.E toolbar-Pls help me Urgent Pin
vcarivu9-Jan-03 20:30
vcarivu9-Jan-03 20:30 
QuestionIs OLE object = to COM?? Pin
E_LISE_LI9-Jan-03 14:14
E_LISE_LI9-Jan-03 14:14 
AnswerRe: Is OLE object = to COM?? Pin
geo_m10-Jan-03 4:44
geo_m10-Jan-03 4:44 
GeneralSTL map of _variant_t Pin
[James Pullicino]5-Jan-03 21:58
[James Pullicino]5-Jan-03 21:58 
GeneralRe: STL map of _variant_t Pin
geo_m7-Jan-03 6:58
geo_m7-Jan-03 6:58 
GeneralAutomation Problem with ROT (Running Object Table) Pin
Alois Kraus3-Jan-03 5:57
Alois Kraus3-Jan-03 5:57 
GeneralMS exchange server - deleting attachments Pin
Ammad Amjad31-Dec-02 20:58
Ammad Amjad31-Dec-02 20:58 
GeneralRe: help me!!!!!!!!!!!!!!!!!!!!! Pin
Renjith Ramachandran31-Dec-02 20:46
Renjith Ramachandran31-Dec-02 20:46 
GeneralRe: help me!!!!!!!!!!!!!!!!!!!!! Pin
Anders Molin3-Jan-03 14:05
professionalAnders Molin3-Jan-03 14:05 
QuestionHow to using the second IDispatch of a COM object in VBScript Pin
bojinyu30-Dec-02 0:10
bojinyu30-Dec-02 0:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.