Click here to Skip to main content
15,922,533 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CWinThread Question... Pin
Dave Bryant5-Dec-02 11:06
Dave Bryant5-Dec-02 11:06 
GeneralRe: CWinThread Question... Pin
RobJones5-Dec-02 11:09
RobJones5-Dec-02 11:09 
GeneralCallbackfunction question Pin
russell thorburn5-Dec-02 8:38
sussrussell thorburn5-Dec-02 8:38 
GeneralRe: Callbackfunction question Pin
Dave Bryant5-Dec-02 8:52
Dave Bryant5-Dec-02 8:52 
GeneralRe: Callbackfunction question Pin
russell thorburn5-Dec-02 11:03
sussrussell thorburn5-Dec-02 11:03 
GeneralCTabCtrl - Should be an easy one Pin
Dave_5-Dec-02 7:37
Dave_5-Dec-02 7:37 
GeneralRe: CTabCtrl - Should be an easy one Pin
Shog95-Dec-02 17:55
sitebuilderShog95-Dec-02 17:55 
Generaltoolbar position problems Pin
MichaT5-Dec-02 6:58
MichaT5-Dec-02 6:58 
GeneralRe: toolbar position problems Pin
Roger Allen5-Dec-02 7:55
Roger Allen5-Dec-02 7:55 
GeneralRe: toolbar position problems Pin
MichaT5-Dec-02 8:06
MichaT5-Dec-02 8:06 
GeneralCFont problem... Pin
Ruca5-Dec-02 6:23
Ruca5-Dec-02 6:23 
GeneralRe: CFont problem... Pin
Michael Dunn5-Dec-02 6:32
sitebuilderMichael Dunn5-Dec-02 6:32 
GeneralRe: CFont problem... Pin
Ruca5-Dec-02 6:48
Ruca5-Dec-02 6:48 
GeneralCHttpFile Pin
Paul M Watt5-Dec-02 6:01
mentorPaul M Watt5-Dec-02 6:01 
GeneralRe: CHttpFile Pin
sonshiro5-Dec-02 18:23
sonshiro5-Dec-02 18:23 
GeneralProbable Memory Leak Pin
Tili5-Dec-02 5:22
Tili5-Dec-02 5:22 
QuestionWhat is the difference between ... Pin
User 98855-Dec-02 5:14
User 98855-Dec-02 5:14 
AnswerRe: What is the difference between ... Pin
Maximilien5-Dec-02 5:24
Maximilien5-Dec-02 5:24 
GeneralRe: What is the difference between ... Pin
User 98855-Dec-02 5:29
User 98855-Dec-02 5:29 
GeneralRe: What is the difference between ... Pin
Maximilien5-Dec-02 5:45
Maximilien5-Dec-02 5:45 
GeneralRe: What is the difference between ... Pin
Daniel Turini5-Dec-02 6:08
Daniel Turini5-Dec-02 6:08 
GeneralRe: What is the difference between ... Pin
User 98855-Dec-02 6:11
User 98855-Dec-02 6:11 
QuestionHow to Expose two COM interfaces Pin
Alois Kraus5-Dec-02 5:08
Alois Kraus5-Dec-02 5:08 
AnswerRe: How to Expose two COM interfaces Pin
peterchen5-Dec-02 7:37
peterchen5-Dec-02 7:37 
There are two basic ways to expose a secondary interface:

a) local classes (MFC does that, including some dirty tricks to make this effective)
b) multile inheritance (ATL does that)

b) is IMO much cleaner, only you can get into problems with method name clashes
Some pseudocode for the latter:
class CCoImpl : public IFun, public ITest
{
   HRESULT QueryInterface()
   {
      if (iid == IUnknown) {  // always return the same pointer when specifically asked for IUnk; which one doesn't matter
        addref, return static_cast<IFun *>(this);
      }
      if (iid == IFun) {
        addref, return static_cast<IFun *>(this); 
      }
      if (iid == ITest) {
        addref, return static_cast<ITest *>(this);
      }
     return E_NOINTERFACE;
   }
   // IFun methods:
   HRESULT GoShopping() { ... }
   HRESULT GoRocking()  { ... }

   // ITest Methods
   HRESULT TestCountShoes(....) { ... }
};


you get the idea...

Neither way you can expose two dispatch (or dual) interfaces - you can only have obe dispatch-based interface per object.


If I could find a souvenir / just to prove the world was here   [sighist]
GeneralVisible area of CDC Pin
S O S5-Dec-02 4:07
S O S5-Dec-02 4:07 

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.