5 Replies - 703 Views - Last Post: 31 May 2009 - 02:21 AM Rate Topic: -----

#1 AGRAC393  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 248
  • Joined: 13-May 09

change the execution window?

Posted 30 May 2009 - 10:27 AM

Hello,
I have a few apps done... Thanks to APW5020, I would like to change the execution window from the standard dos window to a regular window! How can I do this.
Is This A Good Question/Topic? 0
  • +

Replies To: change the execution window?

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4361
  • View blog
  • Posts: 12,180
  • Joined: 18-April 07

Re: change the execution window?

Posted 30 May 2009 - 10:37 AM

A regular window being a GUI window? This means you have to program using libraries or GUI enabled IDE for development. For example, using Visual C++ Express IDE will allow you to build "windows applications" which feature the "normal windows" you are talking about.

But regular C/C++ (without any helper libraries) are console based languages so their output is in the dos style window.

So if you want to step up and get into the whole "visual" aspect then you will need something like Visual C++ Express which is free and you can download it from Microsoft's website.

Visual Studio 2008 Express Editions (Download Visual C++)

I hope that is what you were referring to. Good luck with the development. :)
Was This Post Helpful? 0
  • +
  • -

#3 AGRAC393  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 248
  • Joined: 13-May 09

Re: change the execution window?

Posted 30 May 2009 - 10:41 AM

View PostMartyr2, on 30 May, 2009 - 09:37 AM, said:

A regular window being a GUI window? This means you have to program using libraries or GUI enabled IDE for development. For example, using Visual C++ Express IDE will allow you to build "windows applications" which feature the "normal windows" you are talking about.

But regular C/C++ (without any helper libraries) are console based languages so their output is in the dos style window.

So if you want to step up and get into the whole "visual" aspect then you will need something like Visual C++ Express which is free and you can download it from Microsoft's website.

Visual Studio 2008 Express Editions (Download Visual C++)

I hope that is what you were referring to. Good luck with the development. :)

YES! That is exactly what I want. So when I use VS, do I have to redo all of my code in another language, or is there a place I can just copy and paste it?
Was This Post Helpful? 0
  • +
  • -

#4 apw5020  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 666
  • Joined: 26-March 09

Re: change the execution window?

Posted 30 May 2009 - 10:42 AM

It is more complicated than you might think. Check out KYA's tutorial and the other link I posted for examples.

http://www.dreaminco...wtopic60793.htm

http://bobobobo.word...ic-window-in-c/
Was This Post Helpful? 0
  • +
  • -

#5 AGRAC393  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 248
  • Joined: 13-May 09

Re: change the execution window?

Posted 30 May 2009 - 11:10 AM

View Postapw5020, on 30 May, 2009 - 09:42 AM, said:

It is more complicated than you might think. Check out KYA's tutorial and the other link I posted for examples.

http://www.dreaminco...wtopic60793.htm

http://bobobobo.word...ic-window-in-c/

Ok, what I'm trying to do is get this
#include <iostream>
#include <cstdlib>
#include <cmath>

using namespace std;

int main()
{
	double a, b, c, x1, x2;
	char choice;
		do {
			cout << "						  Aaron's Algebra Formula Calc!\n";
			cout << "\n";
			cout << "Pick A Formula...\n";
			cout << "1. QUDRATIC FORMULA!!!\n";
			cout << "2. Other\n";
			cout << "3. Other\n";
			cout << "Or press 'q' to quit." << endl;
			cin>>choice;
		} while ( choice < '1' || choice > '1' && choice != 'q');
		if (choice == 'q' || choice == 'Q')
			return 0;
		switch (choice)
		{
		case '1':
			system("CLS");
			cout << "Please input a\n";
			cin >> a;
			cout << "Please enter b\n";
			cin >> b;
			cout << "Please enter c\n";
			cin >> c;			
			if(pow(b, 2) < 4 * a * c)
			{
				cout << "Imaginary numbers!" << endl;
				system("PAUSE");
				break;
			}
			x1 = (-b + sqrt(pow(b, 2) - 4 * a * c)) / (2 * a);
			x2 = (-b - sqrt(pow(b, 2) - 4 * a * c)) / (2 * a);
			cout << "x1 = " << x1 << endl;
			cout << "x2 = " << x2 << endl;
			system("PAUSE");
			break;
		}
		return 0;
}	


into a GUI type of window! I don't really need to do anything else as of now but it is a help. So can someone please elaborate on how to do that!
Was This Post Helpful? 0
  • +
  • -

#6 DingleNutZ  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 121
  • Joined: 02-May 09

Re: change the execution window?

Posted 31 May 2009 - 02:21 AM

just use the windows header file and its code equivalents.
all the maths and variables wont need win32 equivalent code just calculate them as normal and wrap it in a win32 skeleton. here is one for you to use:
#include <windows.h>

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

static char gszClassName[]  = "darkblue";
static HINSTANCE ghInstance = NULL;

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
	   WNDCLASSEX WndClass;
	   HWND hwnd;
	   MSG Msg;

	   ghInstance = hInstance;

	   WndClass.cbSize		= sizeof(WNDCLASSEX);
	   WndClass.style		 = NULL;
	   WndClass.lpfnWndProc   = WndProc;
	   WndClass.cbClsExtra	= 0;
	   WndClass.cbWndExtra	= 0;
	   WndClass.hInstance	 = ghInstance;
	   WndClass.hIcon		 = LoadIcon(NULL, IDI_APPLICATION);
	   WndClass.hCursor	   = LoadCursor(NULL, IDC_ARROW);
	   WndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
	   WndClass.lpszMenuName  = NULL;
	   WndClass.lpszClassName = gszClassName;
	   WndClass.hIconSm	   = LoadIcon(NULL, IDI_APPLICATION);

	   if(!RegisterClassEx(&WndClass)) {
			   MessageBox(0, "Error Registering Window!", "Error!", MB_IConstop | MB_OK);
			   return 0;
	   }

	   hwnd = CreateWindowEx(
			   WS_EX_STATICEDGE,
			   gszClassName,
			   "DingleNutZ waZnt haIr!!!",
			   WS_OVERLAPPEDWINDOW,
			   CW_USEDEFAULT, CW_USEDEFAULT,
			   320, 240,
			   NULL, NULL,
			   ghInstance,
			   NULL);

	   if(hwnd == NULL) {
			   MessageBox(0, "Window Creation Failed!", "Error!", MB_IConstop | MB_OK);
			   return 0;
	   }

	   ShowWindow(hwnd, nCmdShow);
	   UpdateWindow(hwnd);

	   while(GetMessage(&Msg, NULL, 0, 0)) {
			   TranslateMessage(&Msg);
			   DispatchMessage(&Msg);
	   }
	   return Msg.wParam;
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
	   HDC hdc;
	   PAINTSTRUCT ps;
	   LPSTR szMessage = "DingleNutZ waZnt haIr!!!";

	   switch(Message) {
			   case WM_PAINT:
					   hdc = BeginPaint(hwnd, &ps);
					   TextOut(hdc, 70, 50, szMessage, strlen(szMessage));
					   EndPaint(hwnd, &ps);
					   break;
			   case WM_CLOSE:
					   DestroyWindow(hwnd);
					   break;
			   case WM_DESTROY:
					   PostQuitMessage(0);
					   break;
			   default:
					   return DefWindowProc(hwnd, Message, wParam, lParam);
	   }
	   return 0;
}


i have chucked some text functions in there for ya.
have fun making your win32 app!!! :D

This post has been edited by DingleNutZ: 31 May 2009 - 02:23 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1