第一步:

KSDLL2.idl文件中

	dispinterface _DKSDLL2
	{
		properties:
		methods:
			[id(1)] void CheckIt();
			[id(2)] BSTR GetIt();
	};

第二步:

KSDLL2Ctrl.h文件中

protected:
	void CheckIt(void);
	BSTR GetIt();

第三步:

KSDLL2Ctrl.cpp文件中

// 调度映射

BEGIN_DISPATCH_MAP(CKSDLL2Ctrl, COleControl)
	DISP_FUNCTION_ID(CKSDLL2Ctrl, "CheckIt", dispidCheckIt, CheckIt, VT_EMPTY, VTS_NONE)
	DISP_FUNCTION_ID(CKSDLL2Ctrl, "GetIt", dispidGetIt, GetIt, VT_BSTR, VTS_NONE)
END_DISPATCH_MAP()

第四步:

KSDLL2Ctrl.cpp文件中

BSTR CKSDLL2Ctrl::GetIt()
{
	CString  strmac;
    strmac="12345123451234512345";
    return strmac.AllocSysString();
}

第五步:

html文件中

 var obj = document.getElementById("Object1");
                var result = obj.GetIt();
                alert(result);

 

相关文章:

  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
  • 2021-09-16
  • 2021-11-29
猜你喜欢
  • 2022-12-23
  • 2022-02-04
  • 2022-12-23
  • 2021-11-28
  • 2021-07-27
  • 2022-01-01
相关资源
相似解决方案