本文介绍了如何在JScript中调用Windows API函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在JScript脚本中获取当前进程ID。此API由Windows API GetCurrentProcessId 返回()功能。如何在JScript中调用此函数?

I would like to obtain the current process id in a JScript script. This id is returned by the Windows API GetCurrentProcessId (http://msdn.microsoft.com/en-us/library/ms683180.aspx) function. How do I call this function in JScript?

这显然不起作用:

var id = GetCurrentProcessId();
WScript.Echo("ProcessId is " + id);


推荐答案

Windows API不可用于JScript运行时。您只能使用,虽然您也可以连接到WMI并创建COM对象的实例,以超越JScript的限制。

Windows APIs aren't made available to the JScript runtime. You're limited to methods and properties listed in the MSDN JScript language reference, although you can also connect to WMI and create instances of COM Objects to extend beyond JScript's limitations.

这篇关于如何在JScript中调用Windows API函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 22:20