Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Windows 7 Taskbar Integration for MFC Applications

Download

Right click “Save as…”

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.

Tags:

Follow the Discussion

  • Joseph HatfieldJoseph 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?
     

  • Mr CrashMr 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.
     

  • John Bristowejbristowe John Bristowe (Developer Evangelist, Telerik)

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

  • Joseph HatfieldJoseph 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.

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

  • MagnusBassPassion Insomniac​Geek

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

     

  • Joseph HatfieldJoseph 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!

  • S EdwardsS Edwards

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

  • 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

close

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.