ActiveX/COM object doing OutputDebugString for use with IE from JavaScript

廉价感情. 提交于 2019-12-08 14:28:15

问题


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:


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



来源:https://stackoverflow.com/questions/18289398/activex-com-object-doing-outputdebugstring-for-use-with-ie-from-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!