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?
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?
where'd you hear THAT from??
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
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.
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
There is some source code (MFC) available here that will run command line stuff in a window.
zen
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
I once messed with a fuction calles fropen that redirects the stdout to a file. I think it went like;
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 wantCode: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);
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
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
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.
Zen, you rock! That link has exactly what I'm looking for.