C++ Console

parkp333's Avatar, Join Date: Feb 2007
Light Poster
How can I intergrate a console in a Windows GUI application. A CMD type thing.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
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?
0
DaWei's Avatar, Join Date: Dec 2006
Team Leader
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;
}
0
parkp333's Avatar, Join Date: Feb 2007
Light Poster
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
0
DaWei's Avatar, Join Date: Dec 2006
Team Leader
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.
0
parkp333's Avatar, Join Date: Feb 2007
Light Poster
Where can I find this stdafx.h header file? and does this make a console inside your GUI window?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
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.
0
parkp333's Avatar, Join Date: Feb 2007
Light Poster
yeh but i wonder how can i make a text box be some batch file i have made can someone give me a tip?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
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?
0
parkp333's Avatar, Join Date: Feb 2007
Light Poster
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...