Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows API for VISTA, 7 & Beyond

Is there any fundamental differences in the WinAPI/Win32? Is there any additional knowledge required to take advantage of new OS features?

Are there any pitfalls which someone who's coded Win32 apps in the past might fall in?

I'm not talking about Silverlight, that's a whole different ball of wax. (I don't have the VS that supports that at work yet.)

Edit: Drew has a pretty good answer so far, but what's critical for a programmer to know? i.e. What should be in an appendix to Charles Petzold's book? (Theoretically)

like image 815
NoMoreZealots Avatar asked Jul 19 '09 01:07

NoMoreZealots


People also ask

Can I still upgrade from Vista to Windows 7 for free?

Unfortunately, Windows Vista upgrade to Windows 7 for free is not available anymore.

Does Windows have an API?

The Windows API (application programming interface) allows user-written programs to interact with Windows, for example to display things on screen and get input from mouse and keyboard. All Windows programs except console programs must interact with the Windows API regardless of the language.

Does Windows Vista have GUI?

Windows Vista's GUI is a 3-D interface called Windows Aero. Of the four editions of Windows Vista, three -- Home Premium, Business and Ultimate -- support Windows Aero. Home Basic, the most scaled-down edition of the OS, uses a less graphics-intensive GUI instead of Aero.

Is Vista faster than 7?

Windows 7 has better speed and performance compared to Windows Vista.


1 Answers

There are of course lots of new APIs that you should be aware of to make sure you have the tools you need. Beyond that, there are some changes to note.

Philosophical changes
Large parts of the old win32 APIs focused on C-style APIs where handles were passed around. Nowadays, many of the new APIs being developed are COM-based, so boning up on COM and ATL would be worthwhile.

You might also want to take note of the new API style if you're writing your own libraries, which is a bit more consistent and avoids things like hungarian notation.

Replacements
Generally, don't assume that the methods you knew about 10 years ago are still state-of-the-art; they all still exist, so you won't necessarily be told you're doing it wrong. Check MSDN to see if it refers you to something better, and use the latest SDK so that you'll get deprecation warnings for some functions. Especially, make sure string functions you're using are secure.

Specifically, one 'replacement' API is Direct 2d, which is a DirectX-style API for UIs. If you're writing graphics code for Windows 7, you should consider Direct2d over GDI, which has a programming model that is compatible with, but very different than, GDI's. Direct 2d may be ported back to Vista.

Also, instead of using win32-style menuing, consider using the Ribbon, which will be available for Vista as well as Win7.

If you're using the common controls library, make sure to use v6, not the default of v5.

Finally, make sure you're not unnecessarily calling things that require admin privileges, as that will prompt UAC.

All I can think of for now.

like image 58
Drew Hoskins Avatar answered Nov 05 '22 15:11

Drew Hoskins