Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to run a .js from a MFC program?

How to run a .js from a MFC program?

Scheduled Pinned Locked Moved C / C++ / MFC
c++javascripttutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Joep
    wrote on last edited by
    #1

    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?

    M 1 Reply Last reply
    0
    • J Joep

      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?

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      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

      J 1 Reply Last reply
      0
      • M Michael Dunn

        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

        J Offline
        J Offline
        Joep
        wrote on last edited by
        #3

        Of course ... thx Michael

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups