javascript调用activex中的函数,并传入字符串
来源:百度知道 编辑:UC知道 时间:2024/06/30 04:14:38
ActiveX需要公布方法给javascript调用。
在ClassWizard中Automation页,添加Method。
手动添加Method:
ODL文件中添加
//{{AFX_ODL_METHOD(CTestCtrl)
[id(3)] void ShowDialog();
//}}AFX_ODL_METHOD
//{{AFX_ODL_METHOD(CTestCtrl)
[id(3)] void ShowDialog();
//}}AFX_ODL_METHOD
CTestCtrl.h中添加:
//{{AFX_DISPATCH(CTestCtrl)
afx_msg void OnShowDialog();
//}}AFX_DISPATCH
//{{AFX_DISP_ID(CTestCtrl)
dispidShowDialog = 3L,
//}}AFX_DISP_ID
//{{AFX_DISPATCH(CTestCtrl)
afx_msg void OnShowDialog();
//}}AFX_DISPATCH
//{{AFX_DISP_ID(CTestCtrl)
dispidShowDialog = 3L,
//}}AFX_DISP_ID
CTestCtrl.cpp中添加:
//{{AFX_DISPATCH_MAP(CTestCtrl)
DISP_FUNCTION(CTestCtrl, "ShowDialog", OnShowDialog, VT_EMPTY, VTS_NONE)
//}}AFX_DISPATCH_MAP
//{{AFX_DISPATCH_MAP(CTestCtrl)
DISP_FUNCTION(CTestCtrl, "