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. [mfc] start/stop other process

[mfc] start/stop other process

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
7 Posts 3 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.
  • R Offline
    R Offline
    rahuljin
    wrote on last edited by
    #1

    hello, i want to start and stop other process (win32 vc++ application without gui) in a mfc dialog application. please tell me how to do that ? for stopping, i read that TerminateProcess() can be used but it should be used in extreme circumstances. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess is used. so is it safe to use it ??

    R 1 Reply Last reply
    0
    • R rahuljin

      hello, i want to start and stop other process (win32 vc++ application without gui) in a mfc dialog application. please tell me how to do that ? for stopping, i read that TerminateProcess() can be used but it should be used in extreme circumstances. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess is used. so is it safe to use it ??

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #2

      Hello,

      rahuljin wrote:

      want to start and stop other process (win32 vc++ application without gui)

      What kind of an application are you developing? You can use ShellExecute[^] to create a process. Or if you want more options and possibly control over the spawned process, there is CreateProcess[^] No, you shouldn't be using TerminateProcess(), but again if you say what kind of application are you writing (and if you have written the spawned process as well), a better alternative might be suggested to you.

      It is a crappy thing, but it's life -^ Carlo Pallini

      R 2 Replies Last reply
      0
      • R Rajesh R Subramanian

        Hello,

        rahuljin wrote:

        want to start and stop other process (win32 vc++ application without gui)

        What kind of an application are you developing? You can use ShellExecute[^] to create a process. Or if you want more options and possibly control over the spawned process, there is CreateProcess[^] No, you shouldn't be using TerminateProcess(), but again if you say what kind of application are you writing (and if you have written the spawned process as well), a better alternative might be suggested to you.

        It is a crappy thing, but it's life -^ Carlo Pallini

        R Offline
        R Offline
        rahuljin
        wrote on last edited by
        #3

        mfc application creates some text files which are used by other win32 c++ program. if i try to access the files through mfc application while win32 c++ program running, it causes the crash of the mfc application (beacuse i dont used any 'if' for file open and i cant). i used the createprocess() and it is working great.

        R 1 Reply Last reply
        0
        • R Rajesh R Subramanian

          Hello,

          rahuljin wrote:

          want to start and stop other process (win32 vc++ application without gui)

          What kind of an application are you developing? You can use ShellExecute[^] to create a process. Or if you want more options and possibly control over the spawned process, there is CreateProcess[^] No, you shouldn't be using TerminateProcess(), but again if you say what kind of application are you writing (and if you have written the spawned process as well), a better alternative might be suggested to you.

          It is a crappy thing, but it's life -^ Carlo Pallini

          R Offline
          R Offline
          rahuljin
          wrote on last edited by
          #4

          please tell me how to use TerminateProcess() function. if there is an alternative for this function, please suggest.

          K 1 Reply Last reply
          0
          • R rahuljin

            please tell me how to use TerminateProcess() function. if there is an alternative for this function, please suggest.

            K Offline
            K Offline
            killabyte
            wrote on last edited by
            #5

            might want to look at ExitProcess() also

            1 Reply Last reply
            0
            • R rahuljin

              mfc application creates some text files which are used by other win32 c++ program. if i try to access the files through mfc application while win32 c++ program running, it causes the crash of the mfc application (beacuse i dont used any 'if' for file open and i cant). i used the createprocess() and it is working great.

              R Offline
              R Offline
              Rajesh R Subramanian
              wrote on last edited by
              #6

              rahuljin wrote:

              mfc application creates some text files which are used by other win32 c++ program. if i try to access the files through mfc application while win32 c++ program running, it causes the crash of the mfc application (beacuse i dont used any 'if' for file open and i cant).

              I don't understand this. If you could explain me better, and tell me what exactly are you trying to achieve, I may be able to help you.

              It is a crappy thing, but it's life -^ Carlo Pallini

              R 1 Reply Last reply
              0
              • R Rajesh R Subramanian

                rahuljin wrote:

                mfc application creates some text files which are used by other win32 c++ program. if i try to access the files through mfc application while win32 c++ program running, it causes the crash of the mfc application (beacuse i dont used any 'if' for file open and i cant).

                I don't understand this. If you could explain me better, and tell me what exactly are you trying to achieve, I may be able to help you.

                It is a crappy thing, but it's life -^ Carlo Pallini

                R Offline
                R Offline
                rahuljin
                wrote on last edited by
                #7

                i created the win32 c++ application long back when i dont have any idea of mfc. it is working fine. with mfc, i create a gui which accept the some content and save them in text files. these text files are then used by the win32 application. win32 application runs at startup of windows and it takes the information from the files and starts using it (it is socket application so it will not read the file again until it receives some information for the ip which is saved in the text file). so i want to restart the win32 application when closing mfc application so that win32 application can use the updated text files. actually i want to use TerminateProcess() and then start it with CreateProcess() function. but i read that TerminateProcess() can create problem with DLL structure.

                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