Click here to Skip to main content
15,890,282 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CreateFileMapping(...) is failed for Windows 7 Version and Windows Vista Pin
Michel Godfroid12-May-10 2:49
Michel Godfroid12-May-10 2:49 
QuestionIs there any way to generate ON_WM_SETCURSOR besides mouse movements Pin
ForNow11-May-10 18:02
ForNow11-May-10 18:02 
QuestionRe: Is there any way to generate ON_WM_SETCURSOR besides mouse movements Pin
sashoalm11-May-10 22:44
sashoalm11-May-10 22:44 
AnswerRe: Is there any way to generate ON_WM_SETCURSOR besides mouse movements Pin
ForNow12-May-10 6:15
ForNow12-May-10 6:15 
QuestionUse of extern "C" in class template Pin
ggoutam711-May-10 16:18
ggoutam711-May-10 16:18 
AnswerRe: Use of extern "C" in class template Pin
«_Superman_»11-May-10 17:14
professional«_Superman_»11-May-10 17:14 
AnswerRe: Use of extern "C" in class template Pin
Stephen Hewitt11-May-10 17:32
Stephen Hewitt11-May-10 17:32 
AnswerRe: Use of extern "C" in class template Pin
ggoutam711-May-10 18:24
ggoutam711-May-10 18:24 
Hello,

Thank you for trying to solve this problem.

I am using samples from "Understanding COM Event Handling" by Lim Bio Liong... URL below :
Understanding COM Event Handling[^]

I am trying to fire event from a ATL dll file, callable from client.
To fire event I need to use class template.
I am using extern "C" before the function name in ATL dll file, to export this function and to make it visible at client.

Below is full code :
__declspec(dllexport) void Init(SMESSAGE* sMessage);
EXTERN_C const IID DIID__IEventFiringObjectEvents;

template <class T>
class CProxy_IEventFiringObjectEvents : public IConnectionPointImpl<T, &DIID__IEventFiringObjectEvents, CComDynamicUnkArray>
{
    //extern "C" __declspec(dllexport) void Init(SMESSAGE* sMessage)
    __declspec(dllexport) void Init(SMESSAGE* sMessage)
    {
        CComVariant varResult;
        VARIANT          var;
        T* pT = static_cast<T*>(this);
        int nConnectionIndex;
        int nConnections = m_vec.GetSize();

        for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
        {
            pT->Lock();
            CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
            pT->Unlock();
            IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);

            if (pDispatch != NULL)
            {
                VariantInit(&var);
                VariantClear(&var);
                V_VT(&var) = VT_RECORD | VT_BYREF;
                V_RECORD(&var) = &sMessage;

                DISPPARAMS disp = { &var, NULL, 5, 0 };
                pDispatch->Invoke(0x4, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
            }
        }
    }

};


Thanking you in advance,
Goutam
AnswerRe: Try ifdef __cplusplus Pin
Software_Developer11-May-10 19:01
Software_Developer11-May-10 19:01 
AnswerRe: Use of extern "C" in class template Pin
ggoutam711-May-10 21:27
ggoutam711-May-10 21:27 
Questionhow to send data to multiple clients from single server mfc or winsock Pin
sravu2511-May-10 15:59
sravu2511-May-10 15:59 
AnswerRe: how to send data to multiple clients from single server mfc or winsock Pin
hanq_3891013011-May-10 16:42
hanq_3891013011-May-10 16:42 
GeneralRe: how to send data to multiple clients from single server mfc or winsock Pin
sravu2511-May-10 22:41
sravu2511-May-10 22:41 
AnswerRe: how to send data to multiple clients from single server mfc or winsock Pin
«_Superman_»11-May-10 17:16
professional«_Superman_»11-May-10 17:16 
QuestionHow you will define the structure model of Sigmund Freud "Id, ego, and super-ego" in C ? :) Pin
phicho11-May-10 10:40
phicho11-May-10 10:40 
AnswerRe: How you will define the structure model of Sigmund Freud "Id, ego, and super-ego" in C ? :) Pin
Richard MacCutchan11-May-10 11:29
mveRichard MacCutchan11-May-10 11:29 
AnswerRe: How you will define the structure model of Sigmund Freud "Id, ego, and super-ego" in C ? :) Pin
CPallini11-May-10 11:30
mveCPallini11-May-10 11:30 
AnswerRe: How you will define the structure model of Sigmund Freud "Id, ego, and super-ego" in C ? :) Pin
phicho11-May-10 18:21
phicho11-May-10 18:21 
GeneralRe: How you will define the structure model of Sigmund Freud "Id, ego, and super-ego" in C ? :) Pin
Richard MacCutchan11-May-10 22:10
mveRichard MacCutchan11-May-10 22:10 
AnswerRe: How you will define the structure model of Sigmund Freud "Id, ego, and super-ego" in C ? :) Pin
sashoalm11-May-10 22:38
sashoalm11-May-10 22:38 
QuestionWindows Obscured or not. Pin
Prakash Nadar11-May-10 10:25
Prakash Nadar11-May-10 10:25 
AnswerRe: Windows Obscured or not. [modified] Pin
Garth J Lancaster11-May-10 11:58
professionalGarth J Lancaster11-May-10 11:58 
GeneralRe: Windows Obscured or not. Pin
Prakash Nadar12-May-10 5:23
Prakash Nadar12-May-10 5:23 
AnswerRe: Windows Obscured or not. Pin
Randor 11-May-10 15:39
professional Randor 11-May-10 15:39 
GeneralRe: Windows Obscured or not. Pin
Prakash Nadar12-May-10 5:26
Prakash Nadar12-May-10 5:26 

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.