Click here to Skip to main content
15,914,447 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: File monitor Pin
sashoalm12-May-10 5:00
sashoalm12-May-10 5:00 
AnswerRe: Also, you can try CFile::GetStatus (MFC) Pin
Software_Developer12-May-10 1:16
Software_Developer12-May-10 1:16 
GeneralRe: Also, you can try CFile::GetStatus (MFC) Pin
suzuuu12-May-10 1:32
suzuuu12-May-10 1:32 
GeneralRe: Also, you can try CFile::GetStatus (MFC) Pin
Software_Developer12-May-10 2:13
Software_Developer12-May-10 2:13 
QuestionIdentify the language of an string. Pin
Comp_Users11-May-10 23:19
Comp_Users11-May-10 23:19 
AnswerRe: Identify the language of an string. Pin
Maximilien12-May-10 0:44
Maximilien12-May-10 0:44 
QuestionCD DVD burning API Pin
raj157611-May-10 23:14
raj157611-May-10 23:14 
AnswerRe: CD DVD burning API Pin
Rajesh R Subramanian12-May-10 2:02
professionalRajesh R Subramanian12-May-10 2:02 
AnswerRe: CD DVD burning API Pin
Ram Shelke11-May-11 21:31
Ram Shelke11-May-11 21:31 
QuestionType Library not getting registered on Windows 7 OS Pin
pandit8411-May-10 21:11
pandit8411-May-10 21:11 
QuestionHow the CComBSTR know which String to pick . Pin
pandit8411-May-10 20:28
pandit8411-May-10 20:28 
AnswerRe: How the CComBSTR know which String to pick . Pin
Richard MacCutchan11-May-10 22:21
mveRichard MacCutchan11-May-10 22:21 
GeneralRe: How the CComBSTR know which String to pick . Pin
pandit8412-May-10 0:55
pandit8412-May-10 0:55 
QuestionCreateFileMapping(...) is failed for Windows 7 Version and Windows Vista Pin
janaswamy uday11-May-10 18:57
janaswamy uday11-May-10 18:57 
AnswerRe: CreateFileMapping(...) is failed for Windows 7 Version and Windows Vista Pin
Michel Godfroid11-May-10 23:46
Michel Godfroid11-May-10 23:46 
GeneralRe: CreateFileMapping(...) is failed for Windows 7 Version and Windows Vista Pin
janaswamy uday12-May-10 2:37
janaswamy uday12-May-10 2:37 
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 

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.