|
-
Oct 27th, 2001, 03:53 PM
#1
Thread Starter
Frenzied Member
C++ very EASY question
ok if you have a program that has this code in it to make a windows app: (from John's tutorial post)
Code:
#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;
}
how would you print something? like in a console app you would put
Code:
#include <iostream.h>
int main()
{
cout << "Hello! Please enter your name: ";
int x;
cin >> x;
}
so how would you put that into a windows app?
-
Oct 27th, 2001, 04:04 PM
#2
Frenzied Member
Go to New , choose win32application, create a new cpp file and put the code in there. As for the printing you could use a message box or an edit box.
-
Oct 27th, 2001, 04:06 PM
#3
Thread Starter
Frenzied Member
well i am very new to C++, like the amount of time i've spent on learning C++ is about 2 hours...so..i am a newbie...so, do you know any good tutorials?
-
Oct 27th, 2001, 07:32 PM
#4
PowerPoster
don't start with windows, first get a good command of the language itself. you will need to. check the faq for the sams online book.
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Oct 27th, 2001, 07:36 PM
#5
Thread Starter
Frenzied Member
yeah..i am going to start learning next semester in school...1st period..C++ heehee..but, it's just been bugging me about how to do that stuff in Windows so how do you do it?
-
Oct 27th, 2001, 07:55 PM
#6
PowerPoster
if you don't know a basic sense of the language, you can't do it, it's just too complex. just start with a few console apps.
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Oct 27th, 2001, 08:05 PM
#7
Better, a whole lot of console apps.
Z.
-
Oct 27th, 2001, 08:20 PM
#8
PowerPoster
yeah, i have been working on and off for the last few months, and i just started with windows apps a little bit. You aren't gonna get anywhere if you don't have a really good command of the language. at least with windows programs
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Oct 28th, 2001, 03:23 PM
#9
but just so you're happy, create a new win32 project and choose A "Hello, World!" application. It will contain exactly what you're searching for.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 28th, 2001, 09:26 PM
#10
PowerPoster
Originally posted by SomethinCool
yeah..i am going to start learning next semester in school...1st period..C++ heehee..but, it's just been bugging me about how to do that stuff in Windows so how do you do it?
You'll still be bored when the teacher teachs you a different way (the way TEACHERS should).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|