Can JavaScript call c++ functions defined in an MFC-based browser app?

Can JavaScript call c++ functions defined in an MFC-based browser app?

Post by Ben Ka » Thu, 04 Apr 2002 03:10:04



I have a specialized browser app based on the MFCIE sample.  Using COM
interfaces, I can call JavaScript functions defined in webpages that
are currently displayed in the document/view area.  I need to set up
the app so that JavaScript code can call functions defined in the
browser app.  Somewhere I read a blurb about setting up the
CDocument-derived object with an automation interface, and then
JavaScript could call functions through "window.external..."  But this
always leads to a JavaScript error.  I don't even know if I did it
right.

Is there a standard way of adding such an interface to the document
object?  Or should the c++ functions be defined elsewhere?  Is this
even possible using MFC?  If anyone knows of a tutorial or a working
example, I'd appeciate it.

Thanx!

 
 
 

1. I want to call a javascript function WITH parameters function from c#

I want to call a javascript function WITH parameters function from c#
code; I already did this:
....
StartDate.Attributes.Add("onTextChange","DateGreaterThan(" +
StartDate.Value + "," + RequiredByDate.Value + ");");
....
in the control (C# code)

What is the syntax to call the function from asp.net?
this does not work:
<combo:WebDateChooser id="StartDate" runat="server"
onValueChange="DateGreaterThan(Date2, Date1);"></combo:WebDateChooser>

this is the function in javascript:

function DateGreaterThan(Date2,Date1)
{ ....}

2. ST <-> SCART -- RGB and Composite Video

3. calling a javascript function from a vb function

4. Suggestion with Upgrade to 9.2.0.1

5. Adding a Windows Forms based composite control to a MFC App.

6. I need ActiveX DVCAM control

7. VC6 and MFC-based Exchange Admin Extension

8. Format Question

9. Reuse MFC-based controls in WinForms?

10. Need really dumb VSS interface for C++ MFC app

11. Minimum .NET framework install for native C++/MFC app?

12. calling user defined functions in SQL SErver 2000

13. Deploying Mixed MFC C++ app in Win98