opening a program outside of C++

This is a discussion on opening a program outside of C++ within the Windows Programming forums, part of the Platform Specific Boards category; I need to know how to start a program and get it running outside of my c++ program. I am ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    6

    opening a program outside of C++

    I need to know how to start a program and get it running outside of my c++ program. I am making a file and need to open it with a different program. I am using dev c++ 4.9.8.0 on Win XP home. I also need to know how you can tell the computer that you have inputed certain keys using c++ and running those keys in the other program. Is it possible or should I just get the user to press the keys himself?

  2. #2
    Registered User Nova_Collision's Avatar
    Join Date
    Feb 2003
    Posts
    40
    CreateProcess() will do it. It has a crapload of parameters, tho. Either look it up in the MSDN help or try this:

    Code:
    STARTUPINFO si;
    PROCESS_INFORMATION pi;
    memset(&pi, 0, sizeof(pi));
    memset(&si, 0, sizeof(si));
    si.cb = sizeof(si);
    int res = CreateProcess("path+executable.exe -parameters", 0, 0, 0, 0, 0, 0, 0, &si, &pi);
    If CreateProcess returns 0 (as in res = 0), then the process creation failed. This is very basic as I only recently figured this out. I'd recommend that you read up on CreateProcess().
    When in doubt, empty your magazine - Murphy's Laws Of Combat #7

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Opening a file from the a console program
    By pritin in forum C++ Programming
    Replies: 20
    Last Post: 09-02-2005, 12:30 PM
  2. Opening program code
    By Shaniac in forum C++ Programming
    Replies: 9
    Last Post: 07-14-2005, 11:55 PM
  3. Replies: 3
    Last Post: 01-14-2003, 10:34 PM
  4. Opening a file from within a program
    By face_master in forum C++ Programming
    Replies: 7
    Last Post: 09-08-2001, 12:06 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

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