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. C / C++ / MFC
  4. I have 3rd party . OCX file. which loads in HTML scripts and do desired work

I have 3rd party . OCX file. which loads in HTML scripts and do desired work

Scheduled Pinned Locked Moved C / C++ / MFC
csharpcomc++htmldotnet
4 Posts 2 Posters 0 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.

    L 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
      #2

      That is MFC code: MFC Desktop Applications | Microsoft Docs[^]. You can also go back to wherever you got the library to see if they have any documentation. I also have a suspicion that CLR and MFC do not mix.

      G 1 Reply Last reply
      0
      • L Lost User

        That is MFC code: MFC Desktop Applications | Microsoft Docs[^]. You can also go back to wherever you got the library to see if they have any documentation. I also have a suspicion that CLR and MFC do not mix.

        G Offline
        G Offline
        Gaurav__Kapoor
        wrote on last edited by
        #3

        I got your point. here i tried to get the object from my ocx and tried to access the functions but I am failing to do so i feel the issue is because of

        IMPLEMENT_DYNCREATE(CMFCActiveXControl1Ctrl, COleControl)

        looking for a sample code if any.

        L 1 Reply Last reply
        0
        • G Gaurav__Kapoor

          I got your point. here i tried to get the object from my ocx and tried to access the functions but I am failing to do so i feel the issue is because of

          IMPLEMENT_DYNCREATE(CMFCActiveXControl1Ctrl, COleControl)

          looking for a sample code if any.

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

          Gaurav__Kapoor wrote:

          i feel the issue is because of

          Forget what you feel and study the documentation. That is the only way to understand the code.

          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