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] restart other process

[mfc] restart other process

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
18 Posts 4 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 created 2 c++ applications, one is win32 and other is mfc. i want to restart the win32 process using mfc application. please tell me how to do this ?? also i want to run only 1 instance of process of both the processes. please suggest ?? btw thanks.

    T C R 3 Replies Last reply
    0
    • R rahuljin

      hello, i created 2 c++ applications, one is win32 and other is mfc. i want to restart the win32 process using mfc application. please tell me how to do this ?? also i want to run only 1 instance of process of both the processes. please suggest ?? btw thanks.

      T Offline
      T Offline
      ThatsAlok
      wrote on last edited by
      #2

      rahuljin wrote:

      i created 2 c++ applications, one is win32 and other is mfc. i want to restart the win32 process using mfc application. please tell me how to do this ?? also i want to run only 1 instance of process of both the processes. please suggest ??

      killprocess and startexecute

      R 1 Reply Last reply
      0
      • R rahuljin

        hello, i created 2 c++ applications, one is win32 and other is mfc. i want to restart the win32 process using mfc application. please tell me how to do this ?? also i want to run only 1 instance of process of both the processes. please suggest ?? btw thanks.

        C Offline
        C Offline
        Code o mat
        wrote on last edited by
        #3

        1. CreateProcess[^] or ShellExecute[^] 2. Google is your friend, but look at this[^].

        > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

        R 1 Reply Last reply
        0
        • C Code o mat

          1. CreateProcess[^] or ShellExecute[^] 2. Google is your friend, but look at this[^].

          > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

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

          createprocess() can start a process but cannot restart a running process.

          C 1 Reply Last reply
          0
          • T ThatsAlok

            rahuljin wrote:

            i created 2 c++ applications, one is win32 and other is mfc. i want to restart the win32 process using mfc application. please tell me how to do this ?? also i want to run only 1 instance of process of both the processes. please suggest ??

            killprocess and startexecute

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

            please explain a bit. i can find good info about the killprocess.

            1 Reply Last reply
            0
            • R rahuljin

              createprocess() can start a process but cannot restart a running process.

              C Offline
              C Offline
              Code o mat
              wrote on last edited by
              #6

              Sorry, i thought by "restart" you meant that the process got killed/exited by someone else, for example by a user action and you wanted to restart it again.

              > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

              1 Reply Last reply
              0
              • R rahuljin

                hello, i created 2 c++ applications, one is win32 and other is mfc. i want to restart the win32 process using mfc application. please tell me how to do this ?? also i want to run only 1 instance of process of both the processes. please suggest ?? btw thanks.

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

                I just replied to your yesterday's post. Ignore it. Answer me here: What *exactly* are you trying to achieve. Why restart a Win32 Process? Why use both Win32 and MFC? None of this makes sense to me. We may probably be able to suggest you a much better way of doing it, but only if you explain what are you trying to do.

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

                R 1 Reply Last reply
                0
                • R Rajesh R Subramanian

                  I just replied to your yesterday's post. Ignore it. Answer me here: What *exactly* are you trying to achieve. Why restart a Win32 Process? Why use both Win32 and MFC? None of this makes sense to me. We may probably be able to suggest you a much better way of doing it, but only if you explain what are you trying to do.

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

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

                  sorry but i could not find my old question. 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.

                  R 1 Reply Last reply
                  0
                  • R rahuljin

                    sorry but i could not find my old question. 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.

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

                    How hard is it to add MFC support to the console application and send a message to it so that it reads the new file again in response to the message? I understand you are having a trouble communicating from your MFC app to the console app?

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

                    R T 2 Replies Last reply
                    0
                    • R Rajesh R Subramanian

                      How hard is it to add MFC support to the console application and send a message to it so that it reads the new file again in response to the message? I understand you are having a trouble communicating from your MFC app to the console app?

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

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

                      the win32 application is not a console application. i dont know how to communication between the two application can be set. in vs2008, i used win32 project (not win32 console application) for creating the win32 application. also the header files used are ---

                      #include <windows.h>
                      #include <winsock.h>
                      #include <tchar.h>
                      #include <wchar.h>
                      #include <iostream>
                      #include <fstream>
                      #include <shlwapi.h>

                      T R 2 Replies Last reply
                      0
                      • R Rajesh R Subramanian

                        How hard is it to add MFC support to the console application and send a message to it so that it reads the new file again in response to the message? I understand you are having a trouble communicating from your MFC app to the console app?

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

                        T Offline
                        T Offline
                        ThatsAlok
                        wrote on last edited by
                        #11

                        Rajesh R Subramanian wrote:

                        How hard is it to add MFC support to the console application and send a message to it so that it reads the new file again in response to the message

                        Can't u send message to Win32 application ?

                        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                        Never mind - my own stupidity is the source of every "problem" - Mixture

                        cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                        R 1 Reply Last reply
                        0
                        • R rahuljin

                          the win32 application is not a console application. i dont know how to communication between the two application can be set. in vs2008, i used win32 project (not win32 console application) for creating the win32 application. also the header files used are ---

                          #include <windows.h>
                          #include <winsock.h>
                          #include <tchar.h>
                          #include <wchar.h>
                          #include <iostream>
                          #include <fstream>
                          #include <shlwapi.h>

                          T Offline
                          T Offline
                          ThatsAlok
                          wrote on last edited by
                          #12

                          Does you application contain or create a window. If yes, you can use Window Messaging to communicate between two application, just add common message id between two application, and related function in WndProc function for win32 application and between BEGIN_MESSAGE_MAP and END_MESSAGE_MAP for MFC application.

                          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                          Never mind - my own stupidity is the source of every "problem" - Mixture

                          cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                          R 1 Reply Last reply
                          0
                          • T ThatsAlok

                            Rajesh R Subramanian wrote:

                            How hard is it to add MFC support to the console application and send a message to it so that it reads the new file again in response to the message

                            Can't u send message to Win32 application ?

                            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                            Never mind - my own stupidity is the source of every "problem" - Mixture

                            cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

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

                            Not if it is a console application.

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

                            T 2 Replies Last reply
                            0
                            • R rahuljin

                              the win32 application is not a console application. i dont know how to communication between the two application can be set. in vs2008, i used win32 project (not win32 console application) for creating the win32 application. also the header files used are ---

                              #include <windows.h>
                              #include <winsock.h>
                              #include <tchar.h>
                              #include <wchar.h>
                              #include <iostream>
                              #include <fstream>
                              #include <shlwapi.h>

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

                              You could send the win32 app a message and a message handler to it. There are several tutorials on IPC in CP, just take a look at those.

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

                              1 Reply Last reply
                              0
                              • T ThatsAlok

                                Does you application contain or create a window. If yes, you can use Window Messaging to communicate between two application, just add common message id between two application, and related function in WndProc function for win32 application and between BEGIN_MESSAGE_MAP and END_MESSAGE_MAP for MFC application.

                                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                                Never mind - my own stupidity is the source of every "problem" - Mixture

                                cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

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

                                there is no create window function in the win32 application. there is only messagebox().

                                modified on Friday, July 24, 2009 4:12 AM

                                1 Reply Last reply
                                0
                                • R Rajesh R Subramanian

                                  Not if it is a console application.

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

                                  T Offline
                                  T Offline
                                  ThatsAlok
                                  wrote on last edited by
                                  #16

                                  Rajesh R Subramanian wrote:

                                  Not if it is a console application.

                                  Humm... we can send window message to container window then :-)

                                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                                  Never mind - my own stupidity is the source of every "problem" - Mixture

                                  cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                                  1 Reply Last reply
                                  0
                                  • R Rajesh R Subramanian

                                    Not if it is a console application.

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

                                    T Offline
                                    T Offline
                                    ThatsAlok
                                    wrote on last edited by
                                    #17

                                    Sorry if my comment hurt. That’s not intentional.. i think you felt bad.. my apology!

                                    "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                                    Never mind - my own stupidity is the source of every "problem" - Mixture

                                    cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                                    R 1 Reply Last reply
                                    0
                                    • T ThatsAlok

                                      Sorry if my comment hurt. That’s not intentional.. i think you felt bad.. my apology!

                                      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                                      Never mind - my own stupidity is the source of every "problem" - Mixture

                                      cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

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

                                      I don't see what's there in your post to hurt me. I also don't know why do you felt that I was hurt. :)

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

                                      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