Any suggestions on books on learning Win32 API?

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 588 Views - Last Post: 15 April 2019 - 08:49 AM Rate Topic: -----

#1 CppIsMyNarnia   User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 17
  • Joined: 10-April 19

Any suggestions on books on learning Win32 API?

Posted 11 April 2019 - 11:47 AM

I tried the search bar but it is either not working or there are no results on Win32. What would be a good, didactic, complete and up to date book to learn the Win32 API?
Is This A Good Question/Topic? 0
  • +

Replies To: Any suggestions on books on learning Win32 API?

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14925
  • View blog
  • Posts: 59,590
  • Joined: 12-June 08

Re: Any suggestions on books on learning Win32 API?

Posted 11 April 2019 - 12:02 PM

Any specific topic?

MS tutorials are pretty good "Get your feet wet" sort of thing.
https://docs.microso...ram-for-windows
https://docs.microso...indows-api-list
Was This Post Helpful? 0
  • +
  • -

#3 CppIsMyNarnia   User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 17
  • Joined: 10-April 19

Re: Any suggestions on books on learning Win32 API?

Posted 11 April 2019 - 12:23 PM

creating windows and forms, I guess. It is said that you need to know something about raw Win32 to learn DirectX properly. I guess it couldn't hurt to learn as much as possible about Win32 before moving to other stuff.
Was This Post Helpful? 0
  • +
  • -

#4 jones30   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 13-April 19

Re: Any suggestions on books on learning Win32 API?

Posted 13 April 2019 - 07:30 AM

I even have interest to learn win32 api and currently i am watching some youtube videos to learn.
Was This Post Helpful? 0
  • +
  • -

#5 CppIsMyNarnia   User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 17
  • Joined: 10-April 19

Re: Any suggestions on books on learning Win32 API?

Posted 13 April 2019 - 09:24 PM

I learn better from books because it's easier to go back and read again. I'm just afraid of buying a bad or outdated book...
Was This Post Helpful? 0
  • +
  • -

#6 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6818
  • View blog
  • Posts: 23,196
  • Joined: 05-May 12

Re: Any suggestions on books on learning Win32 API?

Posted 14 April 2019 - 08:44 AM

In my opinion, the best book to learn the Win32 API is Programming Windows (Developer Reference) 5th Edition. Be sure to get the 5th edition, not the later editions which start doing stuff in C# rather than C/C++.

Despite some parts of the book being outdated, it is the best in moving you up the learning curve of learning the Win32 API. It'll give you a very solid foundation to be able to read the other bits of documentation in MSDN to learn more modern topics.
Was This Post Helpful? 2
  • +
  • -

#7 baavgai   User is offline

  • Dreaming Coder
  • member icon


Reputation: 7419
  • View blog
  • Posts: 15,373
  • Joined: 16-October 07

Re: Any suggestions on books on learning Win32 API?

Posted 14 April 2019 - 10:03 AM

I'll second Petzold's book. One of the few programming I've every actually hunkered down and read. It's good stuff.

View PostCppIsMyNarnia, on 13 April 2019 - 11:24 PM, said:

I'm just afraid of buying a bad or outdated book...

So, it's kind of in the name: WIN32. Win32 showed up in Windows 95 and has remained fundamentally unchanged since then. The API itself is outdated, though still supported. Microsoft can't banish it even if they wanted to, and they've tried a few times. Indeed, it was initially called Win32c, to emphasis it's C compatibility. While they dropped the c from the name, it's still a quirky C centric beast. MFC, while well intentioned, really never came close to killing it.

Because of how Windows works, you're always going to ultimately move through kernel32.dll, etc. Whether you do that down in the C trenches or up in the .NET clouds, you're still going through the same bottleneck. Using C or C++ really only gives you the fun of using those languages. If you enjoy those languages, great. If you're just starting out with Windows UI and are learning C/C++ at the same time, I don't know if this is the nicest thing to do to yourself.
Was This Post Helpful? 1
  • +
  • -

#8 CppIsMyNarnia   User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 17
  • Joined: 10-April 19

Re: Any suggestions on books on learning Win32 API?

Posted 14 April 2019 - 05:46 PM

Answering to both of you latest posters, thank you for sharing the knowledge. I'll see if I can get that book from local used books places, before I go online.

I wouldn't say I'm a C++ beginner, I just never really got interested because of how hard it is compared to managed languages such as Java and C#. I am trying to learn it properly now, instead of stumbling through code-darkness with only google to guide me.

I was planning on learning Win32 after I learn all of C++ to start honing my skills. I would then try MFC to develop something bigger, but since you mentioned MFC is not really an useful framework, what is the alternative to code rich UIs in native C++ for Windows? Proprietary libraries?

Finally, after getting familiar with rich UIs comes my end-goal for my current iteration of self-improvement: DirectX and game design.
Was This Post Helpful? 0
  • +
  • -

#9 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6818
  • View blog
  • Posts: 23,196
  • Joined: 05-May 12

Re: Any suggestions on books on learning Win32 API?

Posted 14 April 2019 - 06:47 PM

MFC went wrong because it was over engineered, but unfortunately overengineered by folks who were treating C++ as "C with classes", as well as trying to compete with then prevalent OWL (Object Windows Library) as well as Delphi being offered by Borland. Think of MFC tries to be a kitchen sink framework/library like Boost, but without as clean a design. Because of the over engineered nature, it is a particularly heavy weight library.

The cleaner, lighter library is ATL. It just provides "just enough" wrapping around the Win32 API and COM to make having to deal with the Win32 API and COM objects in a more object oriented manner.

Some of the Windows division developers thought that ATL was still "too heavy" because it focused on COM primarily, and Win32 API only necessity -- albeit pretty extensively. So anyway, they came up with WTL -- Windows Template Library. This library is laser focused on just giving you a wrapper around just the Win32 API. You'll have to get this from the Windows SDK. It doesn't come installed standard with Visual Studio like MFC and ATL do.
Was This Post Helpful? 2
  • +
  • -

#10 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6818
  • View blog
  • Posts: 23,196
  • Joined: 05-May 12

Re: Any suggestions on books on learning Win32 API?

Posted 14 April 2019 - 07:21 PM

If you don't even want to think about Win32 API, there is always Qt. Personally, I would avoid it like the plague for Windows development, but if I wanted to do cross platform, then I may look at it. Qt is another all-in heavy framework/library.
Was This Post Helpful? 1
  • +
  • -

#11 baavgai   User is offline

  • Dreaming Coder
  • member icon


Reputation: 7419
  • View blog
  • Posts: 15,373
  • Joined: 16-October 07

Re: Any suggestions on books on learning Win32 API?

Posted 15 April 2019 - 05:04 AM

View PostCppIsMyNarnia, on 14 April 2019 - 07:46 PM, said:

since you mentioned MFC is not really an useful framework, what is the alternative to code rich UIs in native C++ for Windows?


To be clear, MFC is useful. Anything Microsoft puts out and supports is useful for developing in their environment. The real question is whether a given framework is worth your time investment for what it offers. There exist die hard supporters for any given extant framework. Indeed, to get a good idea the pros and cons of anything, google both the supporters and detractors and make up your own mind.

I don't really have a dog in the MFC fight, I've just noticed that Microsoft itself seems to have cooled on the thing, which is generally a good bellwether of industry support. e.g. look at the vigor behind the tech pitch and the amount of verbiage devoted: https://docs.microso...tl?view=vs-2019

To be clear, Win32 is C, not C++. Doubtless, every C++ programmer who has had to deal with Win32 has written their own wrappers at some point. I know I did. But there can be some old style C gotchas baked in that are hard to over come. I recall a number global flag things and I think some example code still has gotos. And the pointer obfuscation! That one always kills me.

Now, to be fair, writing a Win32 app can be most satisfying. You will learn a lot about the unvarnished under belly of the OS. So don't be put off, if you like C/C++. I'm actually planning on revisiting this again myself for a little 2048 game I'm playing with: I thought it would be cool to have as a stand alone .exe for a thumb drive.
Was This Post Helpful? 1
  • +
  • -

#12 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6818
  • View blog
  • Posts: 23,196
  • Joined: 05-May 12

Re: Any suggestions on books on learning Win32 API?

Posted 15 April 2019 - 05:54 AM

Technically, the Win32 API is "Pascal", not "C". It just so happened that C won out over Pascal, and then the later APIs added on became more and more C like rather than the more open Pascal. All ancient history. Win32 API can now be thought of as "C", even with the addition of OLE/COM.
Was This Post Helpful? 2
  • +
  • -

#13 baavgai   User is offline

  • Dreaming Coder
  • member icon


Reputation: 7419
  • View blog
  • Posts: 15,373
  • Joined: 16-October 07

Re: Any suggestions on books on learning Win32 API?

Posted 15 April 2019 - 06:54 AM

Pascal?!? With little strings that have the length in the first byte? Delphi was closer than I thought.
Was This Post Helpful? 1
  • +
  • -

#14 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6818
  • View blog
  • Posts: 23,196
  • Joined: 05-May 12

Re: Any suggestions on books on learning Win32 API?

Posted 15 April 2019 - 07:39 AM

Yup, but with the older Windows, strings used to be stored in "atoms" and the atoms were actually stored as Pascal strings.

As another interesting aside, the modern COM/OLE strings storage format is a Unicode string that is null terminated, but also contains the length stored in the word before the first character:
OLE String Pointer--+
                    v
                  5 H e l l o \0


As I recall, this was a concession to work with older VB rather than for Pascal.
Was This Post Helpful? 1
  • +
  • -

#15 CppIsMyNarnia   User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 17
  • Joined: 10-April 19

Re: Any suggestions on books on learning Win32 API?

Posted 15 April 2019 - 08:14 AM

View PostSkydiver, on 14 April 2019 - 06:47 PM, said:

MFC went wrong because it was over engineered, but unfortunately overengineered by folks who were treating C++ as "C with classes", ...


I didn't even know what ATL was. I will definitely have a look on both frameworks after Win32, but I still don't know which one I will choose to use for my big self-imposed "graduation project".
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2