代码之家  ›  专栏  ›  技术社区  ›  harper

如何在JScript中调用Windows API函数?

  •  7
  • harper  · 技术社区  · 14 年前

    我想在JScript脚本中获取当前进程ID。此ID由Windows API返回 获取当前进程ID ( http://msdn.microsoft.com/en-us/library/ms683180.aspx )函数。如何在JScript中调用此函数?

    这显然不起作用:

    var id = GetCurrentProcessId();
    WScript.Echo("ProcessId is " + id);
    
    2 回复  |  直到 14 年前
        1
  •  2
  •   Andy E    14 年前

    Windows API对JScript运行时不可用。您仅限于中列出的方法和属性 MSDN JScript language reference 尽管您也可以连接到WMI并创建COM对象的实例,以扩展到JScript的限制之外。

        2
  •  2
  •   GargantuChet Daniel Pitts    12 年前

    你有答案了 DynamicWrapperX v1.0 .