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. Managed C++/CLI
  4. I have 3rd party .OCX file. and i need to create wrapper to make it usable in C#

I have 3rd party .OCX file. and i need to create wrapper to make it usable in C#

Scheduled Pinned Locked Moved Managed C++/CLI
csharpcomc++htmldotnet
3 Posts 3 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.
  • G Offline
    G Offline
    Gaurav__Kapoor
    wrote on last edited by
    #1

    I have 3rd party . OCX file. which loads in HTML scripts and do desired work Below Steps I have used while creating a Wrapper: 1: In visual Studio-> VC++-CLR-ClassLibrary project 2: Project add Reference (.ocx file) 3: Ref: i am abe to see Interop.Filelib.1.0 4: now in Project.h i am trying to use Filelib but not able to create any object or instance. While i tried to create an Activex project and added .ocx file getting below stuff and i am not able to understand how to use it and create an wrapper for C#. class CDNXCardReaderX : public CWnd { protected: DECLARE_DYNCREATE(CDNXCardReaderX) public: CLSID const& GetClsid() { static CLSID const clsid = { 0x222BBB5D, 0xE9FC, 0x4EB6, { 0x9E, 0xD0, 0x41, 0x10, 0x2C, 0x95, 0xC0, 0x3A } }; return clsid; } virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL) { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); } BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE, BSTR bstrLicKey = NULL) { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID, pPersist, bStorage, bstrLicKey); } // Attributes public: // Operations public: long OpenSessionSync(long Timeout) { long result; static BYTE parms[] = VTS_I4 ; InvokeHelper(0x2d, DISPATCH_METHOD, VT_I4, (void*)&result, parms, Timeout); return result; } I am totally clueless on what approach shall i use to create object and call these functions.

    P L 2 Replies Last reply
    0
    • G Gaurav__Kapoor

      I have 3rd party . OCX file. which loads in HTML scripts and do desired work Below Steps I have used while creating a Wrapper: 1: In visual Studio-> VC++-CLR-ClassLibrary project 2: Project add Reference (.ocx file) 3: Ref: i am abe to see Interop.Filelib.1.0 4: now in Project.h i am trying to use Filelib but not able to create any object or instance. While i tried to create an Activex project and added .ocx file getting below stuff and i am not able to understand how to use it and create an wrapper for C#. class CDNXCardReaderX : public CWnd { protected: DECLARE_DYNCREATE(CDNXCardReaderX) public: CLSID const& GetClsid() { static CLSID const clsid = { 0x222BBB5D, 0xE9FC, 0x4EB6, { 0x9E, 0xD0, 0x41, 0x10, 0x2C, 0x95, 0xC0, 0x3A } }; return clsid; } virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL) { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); } BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE, BSTR bstrLicKey = NULL) { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID, pPersist, bStorage, bstrLicKey); } // Attributes public: // Operations public: long OpenSessionSync(long Timeout) { long result; static BYTE parms[] = VTS_I4 ; InvokeHelper(0x2d, DISPATCH_METHOD, VT_I4, (void*)&result, parms, Timeout); return result; } I am totally clueless on what approach shall i use to create object and call these functions.

      P Offline
      P Offline
      phil o
      wrote on last edited by
      #2

      May that can help you?: C# - Hook into existing COM object | Stack Overflow[^]

      noop()

      1 Reply Last reply
      0
      • G Gaurav__Kapoor

        I have 3rd party . OCX file. which loads in HTML scripts and do desired work Below Steps I have used while creating a Wrapper: 1: In visual Studio-> VC++-CLR-ClassLibrary project 2: Project add Reference (.ocx file) 3: Ref: i am abe to see Interop.Filelib.1.0 4: now in Project.h i am trying to use Filelib but not able to create any object or instance. While i tried to create an Activex project and added .ocx file getting below stuff and i am not able to understand how to use it and create an wrapper for C#. class CDNXCardReaderX : public CWnd { protected: DECLARE_DYNCREATE(CDNXCardReaderX) public: CLSID const& GetClsid() { static CLSID const clsid = { 0x222BBB5D, 0xE9FC, 0x4EB6, { 0x9E, 0xD0, 0x41, 0x10, 0x2C, 0x95, 0xC0, 0x3A } }; return clsid; } virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL) { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); } BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CFile* pPersist = NULL, BOOL bStorage = FALSE, BSTR bstrLicKey = NULL) { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID, pPersist, bStorage, bstrLicKey); } // Attributes public: // Operations public: long OpenSessionSync(long Timeout) { long result; static BYTE parms[] = VTS_I4 ; InvokeHelper(0x2d, DISPATCH_METHOD, VT_I4, (void*)&result, parms, Timeout); return result; } I am totally clueless on what approach shall i use to create object and call these functions.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        You already posted this in the C/C++ forum: please do not repost.

        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