Thread: About running MS-DOS...

  1. #1
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685

    About running MS-DOS...

    I heard that it is possible that you can run a command line application that shows up in an edit control rather than in a dos prompt. Is that true? If so how?

  2. #2
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    where'd you hear THAT from??

  3. #3
    Former Member
    Join Date
    Oct 2001
    Posts
    955
    I have actually seen that working!, but I regret to say that I don't know how it works, but I am going to find out.

    Good Luck

    Oskilian

  4. #4
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Well someone had told me that they had seen it done, and I think everyone could make some use of it. Anyways, if I find any code or anything I'll post it here. If there is a way, i'll spread the word.

  5. #5
    Registered User ski6ski's Avatar
    Join Date
    Aug 2001
    Posts
    133
    I know that i have seen it done as well. I know a guy that might know....I will get back to you on that though.

    If I had to guess, I would say get the handle and capture the output. But that is just a guess.
    C++ Is Powerful
    I use C++
    There fore I am Powerful

  6. #6
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    There is some source code (MFC) available here that will run command line stuff in a window.
    zen

  7. #7
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039
    lol u guys its easy

  8. #8
    Former Member
    Join Date
    Oct 2001
    Posts
    955
    if itīs so easy, tell us how.

    by the way, I think he wants to read the output of the command window, not input to it.

    Oskilian

  9. #9
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    I once messed with a fuction calles fropen that redirects the stdout to a file. I think it went like;

    Code:
    FILE *temp;
    temp = freopen("temprf001", "w", stdout); //stdout now directs to that file
    system("dir c:\\ /s /b");//Run any old dos command to system
    fclose(company);//Close the target file
    
    temp = freopen("c:\\CON", "w", stdout);
    This of course only redirects to a file, but if you could redirect it to the edit window, you would be close to what you want

  10. #10
    Former Member
    Join Date
    Oct 2001
    Posts
    955
    Iīve usead that one too, but it redirects the stdout of this app only (i think), he wants to execute another program and see the output of the ther program

    but, when you use ShellExecute(), you get the
    HINSTANCE of the new program, maybe you can try messing with that one.

    Oskilian

  11. #11
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    I had a quick look at the source to the link I posted and it looks like it creates the stdin,stdout and stderr handles, starts up a thread for each of them, creates a new process and uses ReadFile and WriteFile to get info to and from the handles (it's more complicated than this, check the link if you want more info).
    zen

  12. #12
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    I'll need to try some of those. Sorry for leaving you guys hanging on what my intentions are. I'm trying to spawn another program (command line program to be specific) and display it in an edit box.

  13. #13
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Zen, you rock! That link has exactly what I'm looking for.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Speed test result
    By audinue in forum C Programming
    Replies: 4
    Last Post: 07-07-2008, 05:18 AM
  2. Simple Novice Question: MS DOS app. a console?
    By renurv in forum C++ Programming
    Replies: 7
    Last Post: 12-30-2005, 02:42 PM
  3. MS DOS Window closes right away!
    By poolshark1691 in forum C++ Programming
    Replies: 5
    Last Post: 05-24-2005, 11:35 AM
  4. Replies: 3
    Last Post: 09-26-2002, 11:07 AM
  5. DOS program versus DOS console program
    By scromer in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 01-10-2002, 01:42 PM