[Win32 API] Question about Window Creation

Started by
9 comments, last by Anon Mike 13 years, 4 months ago
Hi there,
prelude-
Im quite used to c++ and practised almost every topic(not good yet with templates).
I read that it would be quite useful to practise a bit with the win32 API before practising directX.

So since last week I got an exercise to present some questions with multiple choices in front of the class,digitally.(power point or however we want to present it)
Well I wanted to give it a try and read a lot tutorials about the Win32 API.
Quite frankly it was very hard to understand.It seemed outdated and totally unorganized(maybe that was just me who doesnt know how to do it properly) in comparison to c++ where everything is quite logically made(in my opinion).Is it really outdated? Do c++ programmers use frameworks or do they really do it only with the win32 API?

The App should be able to do the following:

  • display the question

  • take input via radio buttons(multiple choice)

  • have a continue button which creates the next window with the following questions and the multiple choices

  • show the results at the of the questionnaire



The only thing I cant figure out is to make the continue button continue to the next window with the new question and answers.

I tried to google but didnt find any proper answers or examples on how to do it.
I thought about creating a new window and destroying the old window when prozessing the button,but well...didnt work out:P

It would be nice if someone could guide me on how to properly make that continue button work.

many thanks in advance,
wamackd
Advertisement
Outdated? Yeah, it's 20 years old. Have you read Petzold's book?

For your questionnaire, consider using a series of dialog boxes.
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
sry for answering this late and thanks, and no I didnt read any books only internet tutorials.

those arent detailed either and still dont know how to do it, could you give me another hint for example where I should do it in particular.

thanks in advance,
waMAckD
Well it's not outdated IMHO. Sure there is .NET and WinForms / WPF, but there are a lot of advanced things you can just do with Win32 API knowledge.

That said, if you are using C++, Qt or wxWidgets are quite nice to use. If you need more than create a window and a Direct3D / OpenGL context, I would recommend those libraries, since creating a GUI framework is a lot of work.
My programs still use the winapi. But its wrapped in classes so now its like a couple of lines of code to set up a window.

But other than basic creating and managing a window I no longer use windows for my UI. I just use my own.
Windows moved to using "Windows Forms" for creating a windowed app so if you really need to use buttons and check boxes for a game you are better off creating your own.

Here's a snippet from my button class:

int Button::MouseOver(Mouse* m){	if (m->pos.x >= (pos.x - (width/2)) )	{		if (m->pos.x <= (pos.x + (width/2)) )		{			if (m->pos.y >= (pos.y - (height/2)) )			{				if (m->pos.y <= (pos.y + (height/2)) )				{					Button::Display(imageOn);					if (!soundPlayed)					{						sound->Play();						soundPlayed = true;					}					if (m->GetKeyState(0)->state)					{						return command;					}					return 0;				}			}		}	}	soundPlayed = false;	Button::Display(imageOff);	return 0;}
Quote:I thought about creating a new window and destroying the old window when prozessing the button,but well...didnt work out:P


Why not? Alternatively you could change the text of your question and answers.
Quote:Original post by waMAckD
Is it really outdated? Do c++ programmers use frameworks or do they really do it only with the win32 API?


No one in their right mind should use win32 when there are better apis out there for writing guis. Win32 is a easy way of just writing poorly written programs and incorrect ones. Writing a wrapper around is just a complete waste of time. Yes win32 is outdated and just not worth using at it's raw levels. Win32 is a waste of time using it, while someone uses win32, I could write the same application 100x faster than someone would in win32.
I remember the good old days when, armed with Charles Petzold's excellent tome on this subject, I was coding complex Win32 applications late into the wee hours.

Fun? Sure... I learnt a hell of a lot. Difficult? You bet! Recommended? No... Not when there are far more easier and superior ways to do Windows coding.

Of course, you will have to do some basic Win32 stuff to get a typical DirectX app up and running, like create a window, but as for the rest of the rather large Win32 API, you’re much better off using something like C# or an established Win32 wrapper like MFC.

Honestly, unless you REALLY have an interest to do fundamental Win32 API stuff, you don't really need to know a huge amount of it to create DirectX apps.

If you find yourself in need of creating windows driven tools, C# can do this so easily for you, saving you a HUGE amount of time.
Quote:Original post by CodeStorm
I remember the good old days when, armed with Charles Petzold's excellent tome on this subject, I was coding complex Win32 applications late into the wee hours.

Fun? Sure... I learnt a hell of a lot. Difficult? You bet! Recommended? No... Not when there are far more easier and superior ways to do Windows coding.

Of course, you will have to do some basic Win32 stuff to get a typical DirectX app up and running, like create a window, but as for the rest of the rather large Win32 API, you’re much better off using something like C# or an established Win32 wrapper like MFC.

Honestly, unless you REALLY have an interest to do fundamental Win32 API stuff, you don't really need to know a huge amount of it to create DirectX apps.

If you find yourself in need of creating windows driven tools, C# can do this so easily for you, saving you a HUGE amount of time.


Yeah but that means learning another whole language and using crappy C++/CLI to interop which is just really horrible to use. Plus doesn't work on other platforms (just saying). If you use the native wrappers, go for C# else other another api for window creation and other things.

This topic is closed to new replies.

Advertisement