在HTML中调用VC程序,使用CHtmlView

来源:互联网 发布:淘宝店铺包邮图片 编辑:程序博客网 时间:2024/05/22 03:31
// CustomHtmlView.h : header file
//
class CCustomHtmlView : public CHtmlView
{


DECLARE_DISPATCH_MAP()
DECLARE_DYNCREATE(CCustomHtmlView)
public:






public:
CCustomHtmlView();           // protected constructor used by dynamic creation
virtual ~CCustomHtmlView();


protected:

void StudyLesson(LPCTSTR lpszPath);  //此为在HTML中将被调用的函数

}


CCustomHtmlView::CCustomHtmlView()
{
//{{AFX_DATA_INIT(CCustomHtmlView)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT





EnableAutomation();
}


CCustomHtmlView::~CCustomHtmlView()
{


}

//接口函数,提供给JS调用的函数名为StudyLesson
BEGIN_DISPATCH_MAP(CCustomHtmlView, CHtmlView)
DISP_FUNCTION(CCustomHtmlView, "StudyLesson", StudyLesson , VT_EMPTY ,VTS_BSTR)
END_DISPATCH_MAP()

/************************************************************************/
/*                                                                 
/************************************************************************/
void CCustomHtmlView::StudyLesson(LPCTSTR lpszPath)
{
   //AfxMessageBox("JS调用VC函数成功")
}

原创粉丝点击