Blog Post

Windows 7 Taskbar Integration for MFC Applications

Download this episode

Download Video

Description

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.

Embed

Format

Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image
      Joseph Hatfield

      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?
       

    • User profile image
      Mr Crash

      @Joseph Hatfield:Yes, of course it is possible to make a program use windows 7 features only when they are available.
       
      In other words, your app doesn't have to fail at all !
       
      Programs have been doing this for years.
       

    • User profile image
      jbristowe

      @Joseph Hatfield: You can retrieve the current operating system via GetVersionEx().

    • User profile image
      Joseph Hatfield

      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.

    • User profile image
      WndSks

      @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.

    • User profile image
      BassPassion

      @Joseph Hatfield:

      For what it is worth, I just downloaded the demo VS2010 solution for the Windows 7 Taskbar Demo , compiled and ran it on a Windows XP box, and it ran without any issues.

       

    • User profile image
      Joseph Hatfield

      @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.
       
      COM ftw!

    • User profile image
      S Edwards

      @Karla: Until a newer, even cleaner look to Windows comes along in Windows XX.   :)
      Its the big machine that must keep rolling...

    • User profile image
      GregM

      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.

    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.