0

任何人都可以帮我如何从javascript调用dll函数。使用 activexobject 时出现错误“自动化服务器无法创建对象”。这是我的代码

var jMyAcctId = document.all.RefNum.value;
var jMyAcctType = document.all.TrxType.value;
var NewObject = new ActiveXObject("HDMFCDV.cdv");
if (NewObject.IsValidID(jMyAcctId,jMyAcctType) == true)
{
    document.all.RefNumError.innerText = "";
    CnvUp(sel);
    document.all.CustFName.disabled = false;
    document.all.CustFName.focus();
}

提前坦纳克。

4

1 回答 1

1

Your JavaScript code is good. I suspect the problem is with the HDMFCDV.cdv ActiveX - either they way you implemented it or they way you registered it.

I'm not familiar with HDMFCDV object. Is that a proprietary object you implemented? Here are few tips to troubleshoot:

  1. Make sure your object is registered (did you run regsrv32?)
  2. Verify HDMFCDF.cdv is in the registry: HKCR\HDMFCDF.cdv
  3. Make sure there is a CLSID
  4. Make sure the class ID is in the registry, and that it points to the DLL implementing your object. HKCR\CLSID{your-guide}\InprocServer32 (REG_SZ)
  5. A very common lookout: have you implemented IObjectSafety. Without this interface, and without this interface returning that it is safe for untrusted caller, IE will refuse to instantiate this object
于 2013-01-19T18:56:07.453 回答