ActiveX/COM object doing OutputDebugString for use

2019-06-12 04:26发布

This is specific to Internet Explorer. For certain reasons, I'm unable to use console.log. I'm looking for a simple ActiveX object, safe for scripting, that would allow me to log debug output from JavaScript for viewing with the excellent DbgView tool. The object should use OutputDebugString for that.

Then I could simply use it like this:

<script>
function debugLog(str)
{
  if (window.debugLogAx === undefined) {
    try { window.debugLogAx = new ActiveXObject("IEDebugTools.Logger"); }
    catch(e) { window.debugLogAx = null; }
  }
  if (window.debugLogAx !== null)
    window.debugLogAx.OutputDebugString(str);
}

debugLog("Hello to DbgView from JavaScript!");
</script>

Does such thing exist?

1条回答
神经病院院长
2楼-- · 2019-06-12 05:12

I don't believe such ActiveX exists really, but it's quite easy to create such one. Visual Studio, ATL, new object, add new method, and that's all :)

查看更多
登录 后发表回答