Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

Sign up now

I want to study the WIndows API, need help.

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Thsotus   Members   


Posted 16 January 2011 - 02:19 AM

Hello, everyone, I want to learn the Windows API. I am planning just to create a meager calculator for Windows, and I need to learn the functions needed to create the text boxes and the buttons. Can someone give me a reference to the msdn database and a short explanation on how to use them? Thanks.

I don't understand how to create ANYTHING except an empty window within the Windows API. It's been hard to break into this.

Also, is the Windows API hard to port to other platforms such as Linux or Mac OS X?

Should I use OpenGL or the Windows API to create a 2d game? I know OpenGL is used for heavy 3d graphics, but it seems to hard for me. Is the Windows API better?
http://thsotusgames.wordpress.com/ - My beginning, sad, studios.

#2 MrDaaark   Members   


Posted 16 January 2011 - 02:46 AM

You are better off using something like Winforms to create your program. You can visually design your little calculator app, and then just fill in the code that executes when a button is pressed. There is no need to bother writing out all the widgets by hand.

There are also multi-platform GUI creators. I believe one is called QT, but I have no experience with them.

#3 CableGuy   Members   


Posted 16 January 2011 - 02:55 AM

Most (or all) behavior of a control is determined by it window procedure which is part of its class.
Using CreateWindow and specifying "Button" as the class name would create a button for example.
I second Daaark and can personally recommend wxWidgets.

#4 mhagain   Members   


Posted 16 January 2011 - 06:36 AM

The Windows API isn't that difficult (in some ways it's more straightforward than many of the wrapper APIs that exist) but it does have quite a steep initial learning curve, and does require quite a lot of code to accomplish what seems like fairly small things. This page looks pretty good for getting started.

The one thing that might trip you up is that the Windows API is a procedural C-based API - no classes here! If you come from an OOP background this may be a little strange for you to get used to, so you're probably better off using a wrapper library. Some good suggestions upthread, but I'd like to add that you should think a little about your objective here. Do you want to specifically learn and use the Windows API or do you want to write programs to get stuff done? If the latter, then maybe going for something like Winforms is more suitable for your requirement.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.

#5 assainator   Members   


Posted 16 January 2011 - 11:28 AM

I second mhagain, the win32 API isn't that hard BUT results into very, very unclean code.

Now look the bottom this page to see a example of a very small pure win32 api program. If you are fine with the idea of writing this kind of code, this is the way to go.

But if you come from a OO world, you should probably go with a OO framwork like wxWidgets or QT.

If you do want to use the win32 api, you NEED the 'Programming windows 5th edition' by Charles Petzold. And you need your favorite search engine to find documentation on the win32 api. Often you will be browsing in the msdn documentation.

Hope this helps,


"What? It disintegrated. By definition, it cannot be fixed." - Gru - Dispicable me

"Dude, the world is only limited by your imagination" - Me

#6 Buckeye   GDNet+   


Posted 16 January 2011 - 12:32 PM

If your intent is to write a single Windows application and be done with the Windows API forever, it's overkill and expensive - but I'd recommend looking for the latest edition of Charles Petzold's Programming Windows.

EDIT: Oops, missed the above post. So, I'd second the vote for Petzold.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

#7 MrDaaark   Members   


Posted 16 January 2011 - 12:55 PM

It's not that the Windows API is difficult. It's just a horrible waste of time. Who the hell wants to write out all those widget coordinates, and WndProcs and message handlers, and then compile and run every 15 seconds just to see what the dialog ends up looking like? Even doing the simplest things end up being a giant pain in the ass and you have to fill in large structs and pass them around to a ton of functions that have seemingly 5000 arguments each (with half of them taking giant structs as input!)

You should use something like wxWidgets or Windows Forms. Than you can easily layout any custom form you like, and simply add the code that runs when those buttons are clicked, or something is entered into a control. With WinForms, a lot of things that took paragraphs of code with the regular API have been condensed down to a single function call.

There is also a program called ResEd that can make some Windows Resource scripts for you, but you still have to use the Windows API to use them. http://radasm.cherrytree.at/resed/

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.