Windows with C++: Windows Vista Control Enhancements

The August 2007 issue of MSDN Magazine is out and features my new column entitled Windows with C++. It will initially be published every other month and focuses on Windows Vista and Windows Server 2008 development using C++. As with my Cryptography Next Generation article, each column includes a “What about .NET?” sidebar that showcases how the various techniques discussed in the article can be used from managed code using either C# or C++/CLI.

The first column introduces many of the control enhancements introduced in Windows Vista.

Windows with C++: Windows Vista Control Enhancements

Windows Vista doesn’t introduce many new controls (though it does provide the new Network Address Control, which allows input and validation of IPv4, IPv6, and DNS names), but it offers a number of enhancements and new features to many of the existing standard and common controls. This is good news in a way because it means you can take advantage of many of these new features in your applications with very little effort. In this column, I am going to take you on a whirlwind tour through some of the most commonly used controls and look at various new and exciting features that are provided by Windows Vista and beyond.

Enjoy!

(The various screenshots in this issue don’t look too good online. Hopefully the print edition is in better shape.) Fixed!

If you’re looking for one of my previous articles here is a complete list of them for you to browse through.

© 2007 Kenny Kerr

Published Thursday, July 12, 2007 12:36 PM by KennyKerr

Comments

# re: Windows with C++: Windows Vista Control Enhancements

Thursday, July 12, 2007 1:40 PM by Tim S

You know, there is this great program that I found for doing screenshots in Vista called Window Clippings. Maybe you've heard about it.

:-)

# re: Windows with C++: Windows Vista Control Enhancements

Thursday, July 12, 2007 6:18 PM by KennyKerr

Thanks Tim...  :)

The screenshots were taken using Window Clippings but it looks like they were distorted along the way. Anyway, Mike over at MSDN Magazine has since updated the screenshots with the originals I sent them.

# re: Windows with C++: Windows Vista Control Enhancements

Thursday, July 12, 2007 10:01 PM by ac

The code for the article is a sfx wrapped in another sfx hehe (I know the outer sfx is the normal signed ms sfx, not sure about the other one)

# re: Windows with C++: Windows Vista Control Enhancements

Thursday, July 12, 2007 10:03 PM by ac

and since this is a Vista sample, why use Tahoma as the font instead of the fake ms shell dlg font for auto font selection?

# re: Windows with C++: Windows Vista Control Enhancements

Thursday, July 12, 2007 11:16 PM by KennyKerr

ac: I checked the download and it works fine. The shell dialog fonts don’t work as expected on Vista.

# re: Windows with C++: Windows Vista Control Enhancements

Friday, July 13, 2007 8:06 AM by Mike Sully

I wish there were controls like those used in:

http://www.multiextractor.com

(skinable standard controls)

# re: Windows with C++: Windows Vista Control Enhancements

Friday, July 13, 2007 11:34 AM by Mike Dunn [MVP]

Officially, you're not supposed to use MS Shell Dlg on Vista. You have to explicitly put Segoe UI in your dialog resources. Or, in a more realistic world where we want our apps to run on pre-Vista OSes, detect the OS and tweak the resource in memory to have MS Shell Dlg on pre-Vista and Segoe UI on Vista. Yes, it's as big of a pain as you think. :/

# re: Windows with C++: Windows Vista Control Enhancements

Friday, July 13, 2007 11:42 AM by KennyKerr

Mike: yep, it’s a real pain in native code. I’m toying with simply shipping 2 versions of each dialog resource. It’s slightly less painful but not especially convenient.

# re: Windows with C++: Windows Vista Control Enhancements

Saturday, July 14, 2007 11:32 AM by ac

Replacing the Font in mem is no good, Segoe is supposed to be 9pt, will probably cause size problems, unless you resize every control and dialog and not just the font

# re: Windows with C++: Windows Vista Control Enhancements

Sunday, July 15, 2007 4:30 AM by Leo Davidson

I'm thinking about ditching dialog resources completely and writing code which does all the layout from a table of data in the code.

This would solve the problems of font size dependence as well as mean I no longer have to use the terrible dialog editor in Visual Studio (which doesn't even attempt to help you lay out different controls according to the official guidelines about spacing between different elements -- you have to remember the rules and position things by hand which is ridiculous).

I find it annoying that the tools for Windows GUI developers are still so awful. :(

Or have I missed a trick?

# re: Windows with C++: Windows Vista Control Enhancements

Sunday, July 15, 2007 12:22 PM by KennyKerr

Leo: What we need is a XAML designer that facilitates this (msdn2.microsoft.com/.../aa511258.aspx) and a static analysis tool that can verify your XAML for compliance. Time to write some code!  :)

Visual C# is the closest commercial tool today in the Microsoft tools stable. It is far superior to Visual C++ as far as design-time support goes.