ok if you have a program that has this code in it to make a windows app: (from John's tutorial post)
how would you print something? like in a console app you would putCode:#include <windows.h>
#include <iostream.h>
LRESULT CALLBACK WindowFunc(HWND, UINT, WPARAM, LPARAM);
char szWinNamw[] = "MyWin";
int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR kposzArgs, int nWinMode)
{
HWND hwnd;
MSG msg;
WNDCLASSEX wcl;
wcl.cbSize = sizeof(WNDCLASSEX);
wcl.hInstance = hThisInst;
wcl.lpszClassName = "My Window";
wcl.lpfnWndProc = WindowFunc;
wcl.style = 0;
wcl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcl.hIconSm = LoadIcon(NULL, IDI_WINLOGO);
wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
wcl.lpszMenuName = NULL;
wcl.cbClsExtra = 0;
wcl.cbWndExtra = 0;
wcl.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
if(!RegisterClassEx(&wcl)) return 0;
hwnd = CreateWindow( "My Window",
"Carmageddon TDR2000",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
HWND_DESKTOP,
NULL,
hThisInst,
NULL );
ShowWindow(hwnd, nWinMode);
UpdateWindow(hwnd);
int i;
while(i = GetMessage(&msg, NULL, 0, 0))
{ if (i == -1) break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam; }
LRESULT CALLBACK WindowFunc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, message, wParam, lParam);
}
return 0;
}
so how would you put that into a windows app?Code:#include <iostream.h>
int main()
{
cout << "Hello! Please enter your name: ";
int x;
cin >> x;
}
