File size

File size

File size

File size

File size

18.6 MB

The new Windows 7 taskbar provides capabilities that you can (and should) take advantage of in your applications. These capabilities include Jump Lists, pinning, live taskbar previews and more. In this screencast, Kate Gregory (@gregcons) provides an overview of these capabilities and demonstrates how to support them in your applications built with the MFC (Microsoft Foundation Class) library.

What happens if you build the application to target Windows 7 and use some of these features in the code, and someone then runs the application on Windows Vista or XP? Is it possible to code the app to fail gracefully in that case and just do nothing, or will the app simply not run on those earlier OS?

Of course I can enable features based on the results of GetVersionEx(), but in order to gain access to the new functions, I have to change the WINVER of my project to target Windows 7. My concern was that in targeting Windows 7 in that way it would make the app literally unusable or likely to fail when running on Windows XP. My assumption has been that if you set WINVER to target a specific OS then the app could ONLY be run on that OS or a later version. It would be great news to hear that wasn't true.

@Joseph Hatfield: Yes, setting WINVER target can break down-level platforms since it changes struct sizes etc, so if you do sizeof(structvarname) in your code, it will break. You could maybe try to #include the COM headers with a different WINVER. Or be careful and only use the size constants like NOTIFYICONDATA_V1_SIZE.

Too bad MS did not opt for a min and max version solution when they moved to the NTDDI defines.

@WndSks: Thanks for the suggestion to use COM. That turned out to be quite easy to implement and now I've got the beginnings of a class that handles all the dirty work without the need to change WINVER.

It's really too bad that MFC excludes these APIs unless WINVER is set to at least 0x601. It already does all of the work necessary for the DLL to run on older OSes. If these had not required a WINVER setting, then we could use these APIs without worrying that the WINVER setting would let in some other API in some other part of the program that would prevent the program from working on earlier OSes.

Remove this comment

Remove this thread

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums, or
Contact Us and let us know.