执行OutputDebugString的ActiveX / COM对象与JavaScript一起使用 [英] ActiveX/COM object doing OutputDebugString for use with IE from JavaScript

查看:180
本文介绍了执行OutputDebugString的ActiveX / COM对象与JavaScript一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是Internet Explorer特有的。由于某些原因,我无法使用 console.log 。我正在寻找一个简单的ActiveX对象,安全的脚本,这将允许我记录JavaScript的调试输出,以查看优秀的 DbgView工具。该对象应使用 OutputDebugString 为此。

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>

这样的事情是否存在?

推荐答案

我不相信这样的ActiveX存在,但是很容易创建一个。 Visual Studio,ATL,新对象,添加新方法,这就是:)

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 :)

这篇关于执行OutputDebugString的ActiveX / COM对象与JavaScript一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆