Sign in to follow this  
waMAckD

[Win32 API] Question about Window Creation

Recommended Posts

waMAckD    100
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

Share this post


Link to post
Share on other sites
waMAckD    100
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

Share this post


Link to post
Share on other sites
Triton    138
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.

Share this post


Link to post
Share on other sites
empirical2    567
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.

Share this post


Link to post
Share on other sites
Hacksaw2201    100
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;
}


Share this post


Link to post
Share on other sites
Mussi    4407
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.

Share this post


Link to post
Share on other sites
SeaBourne    120
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.

Share this post


Link to post
Share on other sites
CodeStorm    127
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.

Share this post


Link to post
Share on other sites
SeaBourne    120
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.

Share this post


Link to post
Share on other sites
Anon Mike    1098
Meh, raw win32 isn't that bad. I suspect your basic problem is here:

Quote:
Well I wanted to give it a try and read a lot tutorials about the Win32 API.


As the wise man more-or-less said, tutorials suck. Unfortunately it's been a long time since I was at the newbie win32 stage so I can't recommend anything.

My experience with several win32 frameworks is that while most of them do help with the initial shock people have over the 100 or so lines it takes to make a basic window, once you get past that point you need to know raw win32 anyway to get anything non-trivial done. And once you're at that stage you spend more time fighting the framework then you saved in the beginning.

None of what you want to do is hard. Although I'm not surprised that randomly poking around google wasn't very helpful. It sounds like all you would need to do when the continue button is pressed is to change the text of the controls showing the questions and radio buttons, and maybe show/hide some of the radio buttons depending on the number of answers.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this