You could also take a look at aggregation and containment if you are trying to perform it from the server side. It is not necessarily that COM doesn't support good programming practice, the whole reason for the development of COM was to insulate the client from the details of implementation; thus implementation inheritance is out of the question since it requires too much detailed information over how the "insides" work. COM does support interface inheritance, which is developed through aggregation and containment. These tools allow you to specialize COM interfaces.
Andy Hunter
Posts
-
Can COM interface functions be overloaded? -
The question about how to implement abstract class in COMTheir is quite alot of things that go into making a COM object, however to set you in the right direction: 1. your 2 interfaces I am assuming will be FuncClassOne and FuncClassTwo. To do that you need to define them as such (BTW all COM interfaces derive from IUnknown)
interface FuncClassOne : IUnknown
{
virtual void __stdcall Method1() = 0;
virtual void __stdcall Method2() = 0;
}
interface FuncClassTwo : IUnknown
{
virtual void __stdcall fc2_Method1() = 0;
virtual void __stdcall fc2_Method2() = 0;
}2. Now you will need your COM object, containing your interfaces and the implementations.
class FuncClass : public FuncClassOne,
public FuncClassTwo
{
public:
//every COM object needs to implement these 3 functions
virtual HRESULT __stdcall QueryInterface(REFIID iid, void** ppv);
virtual ULONG __stdcall AddRef();
virtual ULONG __stdcall Release();
//now implement your functions
virtual void __stdcall Method1();
virtual void __stdcall Method2();
virtual void __stdcall fc2_Method1();
virtual void __stdcall fc2_Method2();
//std class stuff
FuncClass();
~FuncClass();
private:
long m_cRef;
};3. Now you need to implement your COM functions This was really just so you could see the COM implementation in C++ for what you were asking (At least I hope it was what you were asking). You really should look on MSDN for what is required to implement the COM functions and how to create CLSIDs and register your component. Unfortunately the topic is just too large to be answered fully, on this post. I hope I at least got you going in the right direction and knowing what to look for now.
-
Cannot register COM serverThanks for the information. I got past the cannot find module error but not I am receiving a cannot find DllRegisterServer entry point error. I have tried removing the macros and explicitly defining the function types. I forward defined them like this:
extern "C" __declspec(dllexport) HRESULT STDAPICALLTYPE DllRegisterServer(); extern "C" __declspec(dllexport) HRESULT STDAPICALLTYPE DllUnregisterServer();
The function bodies look like this:extern "C" __declspec(dllexport) HRESULT STDAPICALLTYPE DllRegisterServer() { return RegisterServer(g_hModule, CLSID_Component1, g_szFriendlyName, g_szVerIndProgID, g_szProgID); } //server unregister extern "C" __declspec(dllexport) HRESULT STDAPICALLTYPE DllUnregisterServer() { return UnregisterServer(CLSID_Component1, g_szVerIndProgID, g_szProgID); }
Again thanks for the help. -
Can COM interface functions be overloaded? -
Windows Xp Theme -
Cannot register COM serverI have created a com server in a dll and when I attempt to register the server using regsvr32 I recieve an error message stating that the module could not be found. I was wondering if anyone new of the cause for that (I have checked the path and it is correct). Thanks in advance.
-
DirectX Question + urgentBest bet is to look at the developers web site :http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/anch_directx.asp[^]
-
DirectX Init problemThankyou for the help. Evidently I wasn't including the libraries in the right area in the project setup. Once I moved everything over to the additional dependencies area it all seemed to work out. I appreciate the help.
-
DirectX Init problemI am using DirectX 9 with VS.Net 2002. When I call the Direct3DCreate9 macro I recieve an unresolved external error when the project links. I have included the platform sdk lib and include files as part of my .net setup and they are both at the top of the list. I am unsure of why I am recieving this error. Any help will be much appreciated.
-
drawing to a bitmap in memoryDo you need to access each pixel individually or just what the user draws? If it is just what is draws and you want it realtime then you can create a shadow bitmap and mirror the drawing logic both on the screen and this bitmap(or whatever device context you wish). If it is only after the user finishes and lets say selects print you could use something like the BitBlt function and copy the drawing area (most likely the client area of the window ) to whatever device context you wish. If you look on MSDN for GDI functions you will find all this information. I am not trying to be vague, I just am not exactly sure what you want to do; maybe if you would rephrase your question I could help more.
-
What is the include needed?If we are talking windows programming than the basic drawing functions (GDI functions) are included when you include the windows header file (windows.h). For console based applications if you look at www.cprogramming.com some people have written custom graphics functions for use with console based apps. Just due a search from the main page.
-
Productivity tipsA good bottle of wine always helped me. ( and I do mean a whole bottle:-D )
-
COM programmingI have just ordered a copy of Inside COM and I was looking into Inside OLE. I was wondering if anyone has read these books or have any other suggestions.
-
Christmas Eve TraditionWell, now is the holiday season and with that comes varied traditions. I know this Christmas Eve my wife and I are going to be smuggling gifts downstairs and enjoying some homemade eggnog (the secret ingredient is Brandy). I know that in my family our Christmas Eve tradition was that when the kids woke up early they would be allowed to open up their stockings whereas in my wife's family they had a 'Santa Chair'. I was hoping that with such a diverse base their is on this board that some people would want to share their Christmas Eve traditions.
-
SPYWARE and AdwareSo perhaps the goal should be to revise the laws in place to make them more specific with regards to common practices today. I know that the majority of the spyware I have detected recently did not come as a part of a download or activex plugin. It most likely was the result of links between web pages. So basically full disclosure in most instances is not provided. As for problems outside of a single nation that is why it might be productive to have INTERPOL police such problems.
-
SPYWARE and AdwareI don't use any of those things and I do have the removers for spyware and adware. My main point is that this is something that just shouldn't be allowed. I believe some changes should be made to make it illegal to install software on your system without explicit consent. These producers of these programs are thriving on the fact that everyone views the subject as an exceptable nusance, whereas I akin it to an unacceptable trespass. The realworld equivalent to what they are doing electronically is someone sneaking into your house and putting up advertisements overnight or someone setting up a video camera in you kitchen to find out what you eat for breakfast in the morning so they can 'better serve your needs'. I believe that something should be done to put a stop to this.
-
SPYWARE and AdwareAs for it only dealing with US matters, I do believe we are long overdue for a worldwide council dealing with internet matters. It could be added as a supplement to the INTERPOL computer crimes division. I mean we have world wide tasks forces to deal with hackers and virus writers, why not simply put out a change which places Adware and Spyware under controls and allows an agency to regulate them? I do not see why it is not controlled by any trade commission at the moment.
-
SPYWARE and AdwareI mean they could group it under the Computer Fraud and Abuse act and just let the Feds deal with it. I believe once inacted it would be pretty easy to enforce. We should start a petition or something along those lines.
-
SPYWARE and AdwareIs it just me or is everyone fed up with spyware and adware. I think it is time some people got together and polled Congress to get rid of this problem all together. As far as I am concerned the installation of unwanted and unapproved programs onto your computer should constitute trespassing with an malicious intent and should be prosecuted as such. I remember a time when I was working on a project and my computer crashed as a result of an unapproved adware install. I lost work over that!!!!! I mean really, writing viruses and worms is illegal, shouldn't spyware be grouped under the same heading?
-
COM programmingHello everyone. I know this is a newbie question but I have to ask. I am pretty comfortable with windows programming in C and C++ as a whole however I am still sketchy over COM development. Specifically I would like to tie in my office solutions to my Visual studio solutions. I understand that interacting with Office requires COm deployment and I was hoping someone might point me in the right direction for finding a good reference. When I first started Windows programming I was told to get Petzold's book. I think it was one of the best investments I ever made. I was wondering and hoping frankly, that there was an equivalent to that with respect to COM programming.