how to open program twice

This is a discussion on how to open program twice within the C++ Programming forums, part of the General Programming Boards category; How would I go about telling a program to open itself twice?? As in... you run Example.exe, and in the ...

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    4

    Question how to open program twice

    How would I go about telling a program to open itself twice??

    As in... you run Example.exe, and in the code it tells it self to open Example.exe AGAIN from where ever it is currently located on the system.

    Is this possible? Me is a C++ noob.


    Thanks.

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    319
    Shellexecute msdn ,

  3. #3
    Registered User
    Join Date
    Mar 2006
    Posts
    4
    can you further explain this? Like I said.. I am very much a noob

  4. #4
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,161
    If you are very much a noob, I question whether what you requested is really what you want to accomplish. Why would you want to do this?
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  5. #5
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    compile this into "test.exe":
    Code:
    #include <iostream>
    #include <cstdlib>
    
    int main()
    {
    	std::cout<<"Ha"<<std::flush;
    	system("./test.exe");
    	return 0;
    }
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  6. #6
    Registered User
    Join Date
    Sep 2005
    Posts
    241
    I don't see any reason to do that except for malicious purposes...

  7. #7
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    there are plenty of reasons to have a program spawn of a copy of itself, but it's better to use threads, which aren't standard in C++

    most programs you use have more than one process running at any given time... how do you think windows could keep track of the mouse and display teh time at the same time?
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  8. #8
    Registered User
    Join Date
    Sep 2005
    Posts
    241
    Yeah but the way he is talkuing about is it executes and then that one executes another one which will execute another one again and it will just keep spawning

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. program to open IE
    By x2012 in forum C# Programming
    Replies: 2
    Last Post: 11-03-2006, 08:07 PM
  2. File Types Automatically Open With My Program
    By ElWhapo in forum Windows Programming
    Replies: 3
    Last Post: 12-29-2004, 04:39 PM
  3. how to make certain file types open IN your program
    By DarkViper in forum Windows Programming
    Replies: 4
    Last Post: 02-06-2003, 10:37 PM
  4. drawing over the open program.
    By Unregistered in forum Windows Programming
    Replies: 6
    Last Post: 01-23-2002, 02:37 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21