Comment by dotandimet

6 years ago

My favorite Win32 tutorial is by Bartosz Milewski, I found it as a series of posts on his CodeCoop website (https://web.archive.org/web/20110129015721/http://www.codeco... ), that were later incorporated into his book "C++ in Action" (also findable online).

He uses C++ to wrap every resource acquisition in a constructor and every release of a resource in the corresponding destructor, so that by allocating new objects on the stack you avoid a whole swath of memory management errors. This was my first encounter with RAII (not sure if he calls it that), and it seems a particularly elegant way to write C++ and to make the raw Win32 C API a lot less scary.