Thread: start and stop a process in task manager

  1. #1
    1337
    Join Date
    Jul 2008
    Posts
    135

    start and stop a process in task manager

    Code:
    #include <cstdlib>
    #include <iostream>
    #include <time.h>
    #include <windows.h>
    using namespace std;
    
    int main(int argc, char *argv[])
    {
        
        int Enter;
        cout<< "please press enter to continue:  "<<endl;
        system("STOP explorer.exe");
        cout<<"note! you are not infected with a virus yet, but you have to press enter again, else your screen will disappear forever"<<endl;
        cin>> Enter;
        if (Enter == VK_RETURN);
           {
           system("START explorer.exe");
           cout<< "fortunately you listened to me, else, your monitor will disappear forever"<<endl;
           }
        
        
        
        
        cin.get();
        return EXIT_SUCCESS;
    }

    why i cant stop the explorer.exe process in the task manager? thanks

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Because you have no idea how anything with this works. Either learn it for real or give it up.

  3. #3
    1337
    Join Date
    Jul 2008
    Posts
    135
    i dont understand what you mean... i am learning c++, and i coded this.

  4. #4
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Yes, and it's random garbage. It doesn't work, it does nothing useful, and if you think you can just simply pass in a stop and start command via system() to imprison explorer.exe and Windows will let you hold a system hostage, I think you have a long way to go.

  5. #5
    Chinese pâté foxman's Avatar
    Join Date
    Jul 2007
    Location
    Canada
    Posts
    404
    To force a process (be it a running instance of explorer.exe or anything else) to terminates on Windows, you would need to get the ID of the process (pid), then get an handle to the process with the PROCESS_TERMINATE access right, then make a call to TerminateProcess. Something like this.

    But if you want my advice, you should try something else. Making direct call to the operating system is usually not trivial for newcomers. Plus, it's always useful to have basic knowledge of how operating system work in these cases. And of course, if you don't know the language (C/C++ in this case), you should forget it.

    EDIT: Haha, seeing the other threads you started on this forum, just forget it completely. You have a really long way to go.
    Last edited by foxman; 07-21-2008 at 12:56 PM.
    I hate real numbers.

  6. #6
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    Why the hell are you attempting to build a virus application ( if that is the intention )
    Double Helix STL

  7. #7
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Wow, not only ignorant, but also in direct violation of the forum rules.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Error stop Http Listener
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 06-04-2008, 02:14 AM
  2. Telling other applications to stop
    By nickname_changed in forum Windows Programming
    Replies: 11
    Last Post: 09-25-2003, 12:47 AM
  3. Software Simulatior
    By vnrabbit in forum C Programming
    Replies: 20
    Last Post: 07-31-2002, 01:32 PM
  4. why cant i start the process i stop using SIGCONT
    By cruxxe in forum C Programming
    Replies: 0
    Last Post: 06-06-2002, 09:06 AM