CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 1999
    Posts
    83

    Beginner ActiveX question

    I am experimenting with an ActiveX app that has no window. Just as an experiment I made a windowless ActiveX control that has only one interface (added by me): Add5().
    This function takes a long as it's input and returns the value with 5 added to it.

    OK, well, creating the control was no big deal, but using it looks like a real bear. If I create a very simple MFC dialog based app and drop the control onto the dialog, I don't see how I access the control.

    How should I use this control (or any control that I just want to call functions on without having the control as a visible object)?

    Regards,

    -Tim

    Dead men don't spam.

  2. #2
    Join Date
    Apr 1999
    Location
    Toronto, ON
    Posts
    713

    Re: Beginner ActiveX question

    When you create ActiveX, or any COM object, it returns to you pointer to IUnknown interface.
    From this you can call function IUnknown::QueryInterface(), that will return pointer to interface you want, if exist. Usually, this interface has some special function you want to use.
    For example, call pointer to you interface Add5() and from there call you function you've been developed.
    After use ActiveX, call Release() function.
    Good source about it is TN038 from MSDN and book "Inside OLE".


    Dmitriy, MCSE

  3. #3
    Join Date
    Aug 1999
    Location
    Denver, CO
    Posts
    3

    Re: Beginner ActiveX question

    Once the control is dropped on your form, you can use Class Wizard to add a member variable from which you can then call the controls methods. Just go to the Member Variables tab, and find your control's ID and add it like you'd add any other control.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured