Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call Windows API functions in 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?

This obviously doesn't work:

var id = GetCurrentProcessId();
WScript.Echo("ProcessId is " + id);
like image 557
harper Avatar asked Aug 17 '10 14:08

harper


2 Answers

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.

like image 189
Andy E Avatar answered Sep 28 '22 22:09

Andy E


You have the answer in DynamicWrapperX v1.0.

like image 45
Antonio Godoy Avatar answered Sep 28 '22 22:09

Antonio Godoy