How to run a .js from a MFC program?
-
I would like to run a local .js WSH file from within a MFC project. The .js file for instance uses a WScript.Quit(1) and WScript.Quit(2) command and I would like to tackle that. :confused: Could anyone give me a hint on how to do this?
You'd need to run wscript.exe (the program that reads the .js file and executes it) with CreateProcess(), and wait on the process handle. The parameter to WScript.Quit() is the exit value of the process, which you get with GetExitCodeProcess(). Check out the article "An Introduction to Processes: Asynchronous Process Notification" for help with using those APIs. --Mike-- http://home.inreach.com/mdunn/ "Didn't I tell you? I've got a brain the size of a planet." --Marvin the paranoid android
-
You'd need to run wscript.exe (the program that reads the .js file and executes it) with CreateProcess(), and wait on the process handle. The parameter to WScript.Quit() is the exit value of the process, which you get with GetExitCodeProcess(). Check out the article "An Introduction to Processes: Asynchronous Process Notification" for help with using those APIs. --Mike-- http://home.inreach.com/mdunn/ "Didn't I tell you? I've got a brain the size of a planet." --Marvin the paranoid android