<p>I can use VS08's MFC/ActiveX template to create a C++ ActiveX object that I can load into a HTML page and script with Javascript. But I can't figure out how to create an interface that allows me to call custom methods on my component with Javascript.</p>

<p>Could you please tell me how to accomplish that? I have spent over two hours on google with no luck.</p>

<p>Thanks.</p>

I'm not extremely familiar with the MFC ActiveX wrapper, but I can answer the question in the general sense:
A COM object with an interface which is derived from IDispatch can be called through automation languages (eg: Javascript). The methods must also be "automation-compatible", which means that the parameters are convertible to the VARIANT type, or are explicitly of type VARIANT. Note that for in/out parameters, the type must be VARIANT* for the automation "hookup" to work.
I don't know how to make the ActiveX object accessible in the client script (eg: embed it into the page), but if it has a single interface derived from IDispatch, that makes it callable from Javascript (and other automation languages). I hope that helps...