locked
Use OCX in VC++ DLL RRS feed

  • Question

  • HI All,

    I have Ingenico device and I got .OCX files in sdk for development.

    My requirement is I want to create wrapper dll in vc++ for that OCX,and that dll should not depend on .net framework(No CLR). Is that possible to wrap ocx in dll without any windowsform just use OCX functions? if yes then can I get some example, because I am new in VC++. If no than, Is there any other way to create wrapper DLL for this device or anybody have idea of ingenico SDK for creating own DLL in VC++ without .NET framework dependency?

    Thanks

    Mayank Rajpura.

    Friday, December 20, 2013 5:26 AM

Answers

  • Hi Rajpura Mayank,

    Base on my understanding, you want to create a dll file to wrap a ocx. And your dll exposes some certain interface to cllient. The dll file can call the methods of ocx according to the needs of the client. If so, you can use CLSIDFromProgID function, CoGetClassObject function then IClassFactory::CreateInstance method to realize what you need.

    CLSIDFromProgID function: Looks up a CLSID in the registry, given a ProgID.

    CoGetClassObject function: Provides a pointer to an interface on a class object associated with a specified CLSID.

    IClassFactory::CreateInstance method : Creates an uninitialized object.

    At last, you can use IUnknown::QueryInterface method retrieves pointers to the supported interfaces on an object.

    If I misunderstood you, please feel free to let me know.

    Best regards,

    Sunny

    • Marked as answer by Anna Cc Wednesday, January 1, 2014 5:32 AM
    Friday, December 27, 2013 1:56 PM

All replies

  • Hi Rajpura Mayank,

    I find that you post this issue there. And you have got a solution. If I misunderstand you, please feel free to let me know.

    Monday, December 23, 2013 1:53 AM
  • HI Sunny

    You are right that post is mine but I am still not satisfied with that answer.

    Now I am thinking of something else. Because I am new in VC++ and OCX and all, can anybody provide me examples or links for How to use ocx(OPOS is preferable) in plain console application or DLL. with no dialogs in application. I am very new in VC++ so sorry if the question very low level and if possible then provide me step by step explanation.

    Thanks

    Mayank Rajpura

    Monday, December 23, 2013 5:20 AM
  • Hi Rajpura Mayank,

    I searched a lot about the "OPOS" you mentioned above and found nothing useful. Could you please clarify it?

    I'm not very clear about what you want.

    As far as I know, you can use "ActiveX Control Pad" to test your .ocx file if your .ocx file has been build. The ActiveX Control Pad is an authoring tool that lets you add ActiveX controls and ActiveX scripting (Visual Basic® Scripting Edition (VBScript) or JScript) to your HTML pages with point-and-click ease.

    The ActiveX Control Pad also includes the Microsoft HTML Layout Control, which provides layout capabilities based on the HTML extensions proposed by the World Wide Web Consortium (W3C). Using the ActiveX Control Pad, you can easily author pages that include advanced layout and multimedia features such as exact object placement, object layering, and transparency effects.

    Please follow the steps below.

    1. Run command prompt with administator

        If your .ocx file exist in folder C:\MyActive\ xxx.ocx, make the path to C:\MyActive.

    2. Register your ocx using "regsvr32 xxx.ocx" command

    3. Run ActiveX Control Pad. 

       Please follow this instruction. Save it and view your control on web.

    Meanwhile, I find a complete sample about using an ocx in a console application.

    Please refer to: http://stackoverflow.com/questions/17928/using-an-ocx-in-a-console-application

    Best Regards,

    Sunny


    • Edited by Anna Cc Tuesday, December 24, 2013 5:53 AM
    Tuesday, December 24, 2013 5:51 AM
  • HI Sunny

    Thanks for your efforts. I appreciate it.

    http://stackoverflow.com/questions/17928/using-an-ocx-in-a-console-application

    Above link is exact what I want to do.I already tried and now I got little way to my task. Please refer the last comment on that post.Now that is my concern as well as I have ocx now I am going to use that in my console as mentioned in above link.

    Now as far as about my task is, I have to create one DLL file in C++(No support for CLR) which will be used as a wrapper on that OCX. OCX is provided with ingenico i6550 device which is magnetic strip reader. Our client will create UI for communicating with device in any language or may be in HTML using our DLL. we don't want any dialogs or window in our DLL just function call to Device using OCX.

    In case of any query please fill free to contact.

    Thanks

    Mayank Rajpura


    Tuesday, December 24, 2013 6:42 AM
  • Hi Rajpura Mayank,

    Base on my understanding, you want to create a dll file to wrap a ocx. And your dll exposes some certain interface to cllient. The dll file can call the methods of ocx according to the needs of the client. If so, you can use CLSIDFromProgID function, CoGetClassObject function then IClassFactory::CreateInstance method to realize what you need.

    CLSIDFromProgID function: Looks up a CLSID in the registry, given a ProgID.

    CoGetClassObject function: Provides a pointer to an interface on a class object associated with a specified CLSID.

    IClassFactory::CreateInstance method : Creates an uninitialized object.

    At last, you can use IUnknown::QueryInterface method retrieves pointers to the supported interfaces on an object.

    If I misunderstood you, please feel free to let me know.

    Best regards,

    Sunny

    • Marked as answer by Anna Cc Wednesday, January 1, 2014 5:32 AM
    Friday, December 27, 2013 1:56 PM
  • Our client will create UI for communicating with device in any language or may be in HTML using our DLL.
    The whole point of ActiveX controls (files with extension *.OCX) is that they can be called by any language that is ActiveX compatible, and that includes any of the .NET languages, and it includes web pages hosted by IE. So please explain why you want to create a wrapper? What will your wrapper offer that isn't available directly through ActiveX?
    Friday, December 27, 2013 4:00 PM