Hey everyone! I'm looking for official documentation on the Windows API that includes examples specifically in C. I've noticed that most of the examples on the official Windows website are in C++. If anyone knows where to find good C examples or if the existing C++ examples can work in C, that would be super helpful!
3 Answers
You might want to check out the Win32 documentation. For example, this link covers the CreateWindowEx function. While it mentions C++, the techniques there should work in plain C as well: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-createwindowexw
The official documentation may appear to be in C++ syntax, but most of it can easily run in C. Just strip away the class-related stuff and you're good to go. Microsoft usually doesn't duplicate examples since C and C++ share 95% of the syntax, so it’s a bit of a hassle for them to maintain too many versions.
Appreciate the input! That makes things clearer for me.
The examples on Microsoft's MSDN site (now learn.microsoft.com) are typically designed to work with a C-only compiler. For instance, look at the CreateFileA function page. If you check the "See Also" section, you'll find examples that can run just fine in a C file, even if they look like C++. It's mostly about SEO and recognition that they showcase C++ in the headers, but the code itself is compatible with C without issues.
Thanks for clarifying about the syntax! That was my concern.

Thanks! I'll definitely check that out.