Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   C++ Console (http://www.go4expert.com/forums/cpp-console-t3325/)

parkp333 9Mar2007 17:12

C++ Console
 
How can I intergrate a console in a Windows GUI application. A CMD type thing.

shabbir 9Mar2007 17:14

Re: C++ Console
 
Quote:

Originally Posted by parkp333
How can I intergrate a console in a Windows GUI application. A CMD type thing.

What do you mean by integrate?

DaWei 9Mar2007 18:13

Re: C++ Console
 
If you'd like to open a separate command window, just execute a system ("cmd.exe"); call. If you want to make your own command interpreter, write it, and replace "cmd.exe" with "myCommandInterpreter.exe" (or whatever you call it).
Code:

#include <windows.h>
#include <process.h>
#include "stdafx.h"

extern "C" int system (char *cmd);

int APIENTRY WinMain(HINSTANCE hInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR    lpCmdLine,
                    int      nCmdShow)
{
        system ("cmd.exe");
        return 0;
}


parkp333 9Mar2007 20:45

Re: C++ Console
 
Well you see I just want a console in my GUI program because I need this to do some winsock because yeh... Well please tell me how to make a console type thing inside a GUI program?? This is very important to me

DaWei 9Mar2007 22:21

Re: C++ Console
 
No, I don't see. Do you see? Did you even read the response? Do you see that it opens a console (without writing the rest of your code, of course). If you don't want the system's console window, make your own window and write your own command interpreter.

parkp333 9Mar2007 22:38

Re: C++ Console
 
Where can I find this stdafx.h header file? and does this make a console inside your GUI window?

shabbir 9Mar2007 22:49

Re: C++ Console
 
Quote:

Originally Posted by parkp333
Where can I find this stdafx.h header file? and does this make a console inside your GUI window?

.h file can do nothing apart from just having some function signatures and stdafx file just does absolutely nothing apart from including some more headers files.

parkp333 9Mar2007 22:51

Re: C++ Console
 
yeh but i wonder how can i make a text box be some batch file i have made can someone give me a tip?

shabbir 9Mar2007 22:56

Re: C++ Console
 
Quote:

Originally Posted by parkp333
yeh but i wonder how can i make a text box be some batch file i have made can someone give me a tip?

Still I could not get what you want to be doing?

parkp333 9Mar2007 22:58

Re: C++ Console
 
I have made this Batch File and I want a text box kind of thing (where user can input) to be related to a batch file... so that if in my batch file i have for example

set hello=
set /p hello=Command:

well that "Command:" appears in the text box in the c++ program...


All times are GMT +5.5. The time now is 19:55.