Need a good WinAPI tutorial

Well, like the title says I need a good winAPI tutorial because I want to do something else then console programming, I have completed the entire C++ tutorial on this website and think I'm ready to learn again.

Why I'm asking on this forum for it?

I've tried a couple of tutorials so far:

theForgers guide to the WinAPI (www.winprog.org)- I got it until it began using resource files which I do not get at all and it doesn't explain it enough (atleast IMO), and it uses it in almost every lesson afterwards. Also when I try to get to the site now, it gives me an error saying that it has either been shutdown or moved to a new web address
---
The tutorial on MSDN - A: Only shows how to create a simple window. B: Has only a little bit of tutorial, most is just sample code, altough I understand how to make a simple window now thanks to theForgers guide.
---
Youtube - Only detailed tutorials are german, but I don't speak german
---
This tutorial on dreamincode http://www.dreamincode.net/forums/topic/60793-introduction-to-the-winapi/ - Gives even less explanation than MSDN
---
This one: http://www.infernodevelopment.com/c-win32-api-tutorial - Gives little documentation, and uses some other arguments for the main function like:
LPSTR lpszArgument,
int nFunsterStil
---
So does anyone have a GOOD tutorial on the API? It would be greatly appreciated!
Last edited on
Is there anything in particular you don't understand?
Those tutorials all seem to be spot-on to me. Perhaps if you post some code and ask what it is that's ambiguous, I could help you.
Actually those tutorials are good, everything you need to know is how to create windowand use window proc, i was learning from those myself, also you can try this site xoax.net and for resources use resedit ...
@both, what tutorials are you talking about in particular? Because I said that the tutorial at www.winprog.org worked for me (I get it) until it got to resource files, since I never used resource files before I barely know what they are, and when I try to look inside the resource file Visual Studio gives me a zillion other files to look at, but my main problem with them is: where do I put the code? For example on the site the code for a small sample menu goes:


#include "resource.h"

IDI_MYICON ICON "my_icon.ico"

IDR_MYMENU MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit", ID_FILE_EXIT
END
END

I figured since I couldn't write code inside a resource file, and it includes a header file, it has to be inside the .cpp source file.
But in the full source code that I downloaded from the site, it wasn't there.
And it wasn't in the header file either (the code couldn't have been there anyway because it includes it) so where DO I put it?

@mekkatorqu

Thanks for the site, a lot, xoax.net really helped as you can read above, the problem was that I couldn't figure out where to put it I'm pretty much a newbie when it comes to the most simple things.


Thanks a lot to both of you for helping me out, as I'm one step closer to becoming a C++ programmer.
Resource files usually has an .rc extension and it is usually grouped inside "resource" section of your IDE project tree (Code::Blocks has all you need and it is a free IDE).
I'm assuming that you're using the Microsoft Visual Studio compiler.
When you compile a program and build an executable, sometimes you may want to add resources to the final binary program. That is, you hardcopy the images, menus, icons, and/or binary data in addition to the compiled source code which makes your program.

These 'addons' to your program are called resources.
Usually, the Microsoft Visual Studio Professional (and Premium, Ultra) have a resource editor that allow you to make resources. However, you can also build resource files from scratch if necessary, such as if you have the express edition.

The resource (.rc) file is a script which the compiler uses that tells it which binary data to hardcopy to the executable.

Typically, the format for adding resources are like so.
[resource name] [data type] [path of resource]

Of course, you specify your own resource name and type, but if you want to use resources in MS-specific functions such as GetObject(), then you may want to use some of the MS-specific types available (see below). The compiler may provide special headers for resource types so they ma be recognized for such functions.

The resource (.rc) file must be part of the solution in order for the compiler to use it as part of the build. Sometimes, people may use #define macros in the header file ( this header is included in the .cpp file and the .rc script) followed by an integer as part of the resource name so that they may use the MAKEINTRESOURCE() macro.

You can find more information here:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa380599%28v=vs.85%29.aspx

http://msdn.microsoft.com/en-us/library/windows/desktop/ms648009%28v=vs.85%29.aspx

http://msdn.microsoft.com/en-us/library/windows/desktop/ff468902%28v=vs.85%29.aspx

how I said, use ResEdit to create resources, it will create .h and .rc files in your folder and you can simply create GUI of your app in ResEdit, then just import existing files to rescource files > .rc and header files > .h, add to .cpp

#include "resource.h" or however is your resource called

also if you want to view resource.rc in visual studio just right click on it and select "view code", it's the same as double-click on .cpp or .h file
Topic archived. No new replies allowed.