If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

CHtmlView - javascript accessing your c++ variables/functions ?

I have a project that has a CHtmlView. This html view displays user customizable html files.

However from my program I want to supply variables (strings mainly) and/or provide functions that can be called from the javascript of the hosted pages.

The idea is that the javascript can then use those variables to dynamically generate the content the users want to be seeing in the form they want to see it.

Essentially... Start a new project in MFC.
Template: MFC application
In Generated classes: chance 'CView' to 'CHtmlView'.
Open the view class and change the Navigate2() call to point to a local html file.

Now, when running, I would like the "MyVariableHere?" be replaced by a variable (CString) that's being calculated from the C++ code. How do I set script variables from my C++ code" ?

The page doesn't need to autoupdate as the CString changes it just needs to be able to use the variables at load. If it could get updated values so you can set a timer in the script to keep a portion updated that would be awesome, but not required.