开发者

Is it worth it to memorize windows API "language"

开发者 https://www.devze.com 2023-01-04 11:35 出处:网络
so i read a tutorial saying it is not worth it to memorize the windows API template. Do you as p开发者_StackOverflow中文版rogrammers memorize the template or just create one from the wizard? also does

so i read a tutorial saying it is not worth it to memorize the windows API template. Do you as p开发者_StackOverflow中文版rogrammers memorize the template or just create one from the wizard? also does anyone know a good web source to learn windows programming better? theForger's is okay but more of a reference guide than a learning source


It is always beneficial to understand how something works before using tools that hide some of that stuff away. There's no harm in using class wizards and templates in the long term, but you'll find debugging problems much easier if you grok what things those wizards and templates did for you and what those things do. This holds true whether if is Win32, .NET, or any other API.

It is especially helpful when programming .NET to have an understanding of the operating system on which it executes and how certain .NET features (such as events) map to the underlying system (e.g Windows messages), as this can really help when debugging some bizarre situations (such as re-entrancy in a .NET ListView control when asking for the item count in a paint message).

That said, it is not imperative that you know these things, just helpful. You certainly shouldn't need to remember the signatures of specific methods - documentation will always help you out there. In general, remember how things work, not how you call them.


For me. The only way to memorize an API is to use it a lot. There is simply too much to know in most APIs and they change so frequently to memorize them all.

Back in the old days when the Internet was not omnipresent, all info was retrieved from magazines and books. Now it is just a matter of cut and paste from sample code and extending that. I still used Cut and paste for skeleton code from previous projects.

My advice is to understand the APIs and know where to get information quickly.


IMHO, it's not very hard to remember CreateWindow's params by heart. Also, it's pretty useful to be familiar with the native API of the system you are working with.


I don't think memorising it is worth it. That's what help files and the Internet are there for.

If you're keen to learn "naked" Win32 programming without .NET, MFC or ATL (and it is good to understand the building blocks these frameworks are built on) then I'd recommend taking it a piece at a time (starting with the basics of WinMain, WndProc etc.) and build your own class framework to cut down on the boilerplate code you write with each new project.

Stick it all in source control, and as you learn more about the API and make improvements to your framework, all of your projects can benefit.


No one would or should memorize Windows API syntax nowadays, we've got IntelliSense in Visual Studio. What you have to do is to understand the model behind these APIs, the way the Windows system works.

Focus on these topics:

  • Window creation and handling, message queues
  • Graphic and font handling (GDI)
  • Standard controls (editbox, buttons...)
  • Events and user input (mouse, keyboard)
  • Processes and threads
  • File handling and other kind of I/O

The most common way is to read some classic book (Charles Petzold's, Jeffrey Ritcher).

By the way, this applies to any framework built over the Windows API: MFC, ATL, and even .net with Windows Forms.


Whether you are using a wizard or not, you should have a general understanding of the code being generated so that you can understand exactly how your program works. Everything is documented on in the online MSDN reference, so if there is something you don't understand about the wizard's code, why not look it up?

Personally, I would stick to using templates as a starting point since there can be a lot of boilerplate code when working with the Windows API. But that's just me...

0

精彩评论

暂无评论...
验证码 换一张
取 消