Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. COM
  4. Call an COM Server dispinterface C++

Call an COM Server dispinterface C++

Scheduled Pinned Locked Moved COM
c++comhelpquestioncsharp
3 Posts 2 Posters 7 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Juergen_80
    wrote on last edited by
    #1

    Hi All, I have a little tricky question for you all. Maybe (I hope so) someone can help me with my problem. I work in Visual Studio 2005 with an C++ project. This project does not support ATL + MFC and it should not be changed, if it’s possible. Now I should call an function / get an information out of an COM (.exe) server that is still running. Below you can see the code that was created by the MIDL Compiler / by the OLE/COM Object Viewer from my test_programm.exe(COM server). In the code of the Test.idl file you can see the following: dispinterface ICWOLEEvents { properties: methods: [id(0x00000001)] void OnConfigurationApply([in, out] VARIANT_BOOL* pAccept); [id(0x00000002)] void OnShowMessageDlg( [in] IMsgDlg* pIMsg, [out, retval] VARIANT_BOOL* Result); }; The problem now I have is that I must call / work with the OnConfigurationApply and the OnShowMessageDlg functions in my C++ project. I’ve implemented the three (Test_h.h / Test_i.c / Test.idl) files in my project and I could recompile it without any error messages. Now my questions are: - How can I work with these two functions(OnConfigurationApply and the OnShowMessageDlg) in my C++ project? - Is there anywhere an simple/complete c++ example project? - Can someone explain me how I must start to work / get some information with these functions? I’ve posted a few weeks a similar question. But now after my holiday I will post this question a little bit more detailed again. Let me know if you need any more information about these files. MANY MANY thanks for any hints. Juergen Test_h.h

    .
    .
    .
    MIDL_INTERFACE("6775FB91-B5BE-11D6-A996-0050BA24C7B9")
    ICWOLEEvents : public IDispatch
    {
    };
    .
    .
    .

    Test_i.c //Created with the MIDL Compiler

    .
    .
    .
    MIDL_DEFINE_GUID(IID, IID_ICWOLE2,0xF560F761,0x2948,0x11D7,0xA9,0xBF,0x00,0x50,0xBA,0x24,0xC7,0xB9);
    MIDL_DEFINE_GUID(CLSID, CLSID_CWOLEv2,0xF560F763,0x2948,0x11D7,0xA9,0xBF,0x00,0x50,0xBA,0x24,0xC7,0xB9);
    .
    .
    .

    Test.idl // Generated .IDL file (by the OLE/COM Object Viewer) // // typelib filename: test_programm.exe

    [
    uuid(90B4344B-90CD-4527-BC00-4F4D45C793D6),
    version(2.13),
    helpstring("CW CWOLE")
    ]
    library CW_CWOLE
    {
    // TLib : // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
    importlib("stdole2.tlb");

    // Forward declare all types d
    
    J S 2 Replies Last reply
    0
    • J Juergen_80

      Hi All, I have a little tricky question for you all. Maybe (I hope so) someone can help me with my problem. I work in Visual Studio 2005 with an C++ project. This project does not support ATL + MFC and it should not be changed, if it’s possible. Now I should call an function / get an information out of an COM (.exe) server that is still running. Below you can see the code that was created by the MIDL Compiler / by the OLE/COM Object Viewer from my test_programm.exe(COM server). In the code of the Test.idl file you can see the following: dispinterface ICWOLEEvents { properties: methods: [id(0x00000001)] void OnConfigurationApply([in, out] VARIANT_BOOL* pAccept); [id(0x00000002)] void OnShowMessageDlg( [in] IMsgDlg* pIMsg, [out, retval] VARIANT_BOOL* Result); }; The problem now I have is that I must call / work with the OnConfigurationApply and the OnShowMessageDlg functions in my C++ project. I’ve implemented the three (Test_h.h / Test_i.c / Test.idl) files in my project and I could recompile it without any error messages. Now my questions are: - How can I work with these two functions(OnConfigurationApply and the OnShowMessageDlg) in my C++ project? - Is there anywhere an simple/complete c++ example project? - Can someone explain me how I must start to work / get some information with these functions? I’ve posted a few weeks a similar question. But now after my holiday I will post this question a little bit more detailed again. Let me know if you need any more information about these files. MANY MANY thanks for any hints. Juergen Test_h.h

      .
      .
      .
      MIDL_INTERFACE("6775FB91-B5BE-11D6-A996-0050BA24C7B9")
      ICWOLEEvents : public IDispatch
      {
      };
      .
      .
      .

      Test_i.c //Created with the MIDL Compiler

      .
      .
      .
      MIDL_DEFINE_GUID(IID, IID_ICWOLE2,0xF560F761,0x2948,0x11D7,0xA9,0xBF,0x00,0x50,0xBA,0x24,0xC7,0xB9);
      MIDL_DEFINE_GUID(CLSID, CLSID_CWOLEv2,0xF560F763,0x2948,0x11D7,0xA9,0xBF,0x00,0x50,0xBA,0x24,0xC7,0xB9);
      .
      .
      .

      Test.idl // Generated .IDL file (by the OLE/COM Object Viewer) // // typelib filename: test_programm.exe

      [
      uuid(90B4344B-90CD-4527-BC00-4F4D45C793D6),
      version(2.13),
      helpstring("CW CWOLE")
      ]
      library CW_CWOLE
      {
      // TLib : // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
      importlib("stdole2.tlb");

      // Forward declare all types d
      
      J Offline
      J Offline
      Juergen_80
      wrote on last edited by
      #2

      Is nobody out there who can help me? A link to a complete tutorial or anything else?

      1 Reply Last reply
      0
      • J Juergen_80

        Hi All, I have a little tricky question for you all. Maybe (I hope so) someone can help me with my problem. I work in Visual Studio 2005 with an C++ project. This project does not support ATL + MFC and it should not be changed, if it’s possible. Now I should call an function / get an information out of an COM (.exe) server that is still running. Below you can see the code that was created by the MIDL Compiler / by the OLE/COM Object Viewer from my test_programm.exe(COM server). In the code of the Test.idl file you can see the following: dispinterface ICWOLEEvents { properties: methods: [id(0x00000001)] void OnConfigurationApply([in, out] VARIANT_BOOL* pAccept); [id(0x00000002)] void OnShowMessageDlg( [in] IMsgDlg* pIMsg, [out, retval] VARIANT_BOOL* Result); }; The problem now I have is that I must call / work with the OnConfigurationApply and the OnShowMessageDlg functions in my C++ project. I’ve implemented the three (Test_h.h / Test_i.c / Test.idl) files in my project and I could recompile it without any error messages. Now my questions are: - How can I work with these two functions(OnConfigurationApply and the OnShowMessageDlg) in my C++ project? - Is there anywhere an simple/complete c++ example project? - Can someone explain me how I must start to work / get some information with these functions? I’ve posted a few weeks a similar question. But now after my holiday I will post this question a little bit more detailed again. Let me know if you need any more information about these files. MANY MANY thanks for any hints. Juergen Test_h.h

        .
        .
        .
        MIDL_INTERFACE("6775FB91-B5BE-11D6-A996-0050BA24C7B9")
        ICWOLEEvents : public IDispatch
        {
        };
        .
        .
        .

        Test_i.c //Created with the MIDL Compiler

        .
        .
        .
        MIDL_DEFINE_GUID(IID, IID_ICWOLE2,0xF560F761,0x2948,0x11D7,0xA9,0xBF,0x00,0x50,0xBA,0x24,0xC7,0xB9);
        MIDL_DEFINE_GUID(CLSID, CLSID_CWOLEv2,0xF560F763,0x2948,0x11D7,0xA9,0xBF,0x00,0x50,0xBA,0x24,0xC7,0xB9);
        .
        .
        .

        Test.idl // Generated .IDL file (by the OLE/COM Object Viewer) // // typelib filename: test_programm.exe

        [
        uuid(90B4344B-90CD-4527-BC00-4F4D45C793D6),
        version(2.13),
        helpstring("CW CWOLE")
        ]
        library CW_CWOLE
        {
        // TLib : // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
        importlib("stdole2.tlb");

        // Forward declare all types d
        
        S Offline
        S Offline
        Stuart Dootson
        wrote on last edited by
        #3

        To implement a connection point handler (for that is what you need to do), you need to implement a COM object that can receive those events. This CodeProject article[^] seems to explain it quite nicely without using ATL or MFC.

        Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups