CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: ActiveX control

  1. #1
    Join Date
    Dec 2009
    Posts
    1

    ActiveX control

    Hello!

    Im trying to make an activex control that will be downloaded from a webpage, and then, throught javascript, i will communicate with the control in order to get some data. In other words, in the web page, the javascript will use the control object, and the object will return some values, thats all.

    The webpage/javascript part is quite easy:

    <html>
    <head>
    <title>activex control test</title>

    <script type="text/javascript">
    function go(){
    window.alert(MyActiveX.getvalue());
    }
    </script>
    </head>
    <body>

    <OBJECT ID="MyActiveX" WIDTH=0 HEIGHT=0
    CLASSID="CLSID:5D540E56-1ED3-479F-966F-F1DCA9FBF6F7">
    <PARAM NAME="_Version" VALUE="65536">
    <PARAM NAME="_ExtentX" VALUE="2646">
    <PARAM NAME="_ExtentY" VALUE="1323">
    <PARAM NAME="_StockProps" VALUE="0">
    </OBJECT>

    <input type="button" onclick="go();" value="start"/>

    </body>
    </html>

    We have the object that has de classid for the activex control that is already in the user computer, and also the name of the object we are going to use in javascript (MyActiveX). So in the javascript function, we only call the method "getvalue()" of the object "MyActiveX" that is in the activex control.

    The problem is that i made the activex control in Visual Studio 2005, but I cant add new functions, only use the ones that are created in the object by default.
    What I do is, in Visual Studio, New project, in MFC -> MFC Active Control, put the name "MyActiveX", and in the final window, go to control configuration and check all the checkboxes.
    Once the project is created, i declare a new function "getvalue()" in the .h file, and put the content of the function in the .cpp file:

    int CMyActiveXApp::getvalue()
    {
    return 5;
    }

    I compile, and the .ocx file is created, so i get the CLSID (the unique id for the ocx file) using the Microsoft ActiveX Control Pad Software, and i make the object in the HTML webpage as I showed before (<object etc...>). As the ocx file is already registered in my computer, i can call the ocx object using javascript, so if i call the default function AboutBox(); the dialog appears! but if i call the function i created, getvalue(), it doesnt do anything.

    Does someone have any idea? I would appreciate any help : )

    Thanks!

  2. #2
    Join Date
    Jan 2009
    Posts
    1,689

    Re: ActiveX control

    I believe that GetValue is reserved for ActiveX controls, I'm certain that it is for Netscape Plugins. Call it something else and see if you have the problem.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)