This is post number 9 in a series that describes new and updated samples in the Windows 7 SDK.  The following table lists samples that pertain to Windows User Interface, and are new to Windows 7 or updated to support Windows 7.   Technologies include Shell, Locations and Sensors, Sidebar, Sideshow, Windows Ribbon, Windows Search, and more.  These samples are new to Windows 7 or updated to support Windows 7.

See also:

New Win32 Samples in Windows SDK for Windows 7: Networking and Related Services

New Win32 Samples in Windows SDK for Windows 7: Multimedia

New Win32 Samples in Windows SDK for Windows 7: Security

New Win32 Samples in Windows SDK for Windows 7: Systems Management

New Win32 Samples in Windows SDK for Windows 7: Open Packaging Conventions (OPC)

New Win32 Samples in Windows SDK for Windows 7: Tablet PC and MultiTouch

New Win32 Samples in Windows SDK for Windows 7: Web

New Win32 Samples in Windows SDK for Windows 7: Windows Base

New Win32 Samples in Windows SDK for Windows 7: Windows User Interface

New Win32 Samples in Windows SDK for Windows 7: Windows XML Paper Specification (XPS)

New Win32 Samples in Windows SDK for Windows 7: Communication

 

 

Over 1,200 samples were changed since the release of the Windows SDK for Windows 7 RC release. Many “new to Win 7” samples were added, simplified, or extended, and many older samples were updated to support Windows 7 as well as older operating systems.

 

For build instructions and additional information about the samples, see the Readme.txt files and other documents in the SDK sample folders. For general sample building instructions, refer to the Samples Reference page that installs with the Windows SDK, and the SDK Release Notes (under the Start menu, in All Programs > Microsoft Windows SDK v7.0). By default, Win32 samples are installed under the following path: C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples.

 

Send your thoughts to the Windows SDK Feedback alias.  Tell us how you use the SDK and what we can do to improve your development experience.

 

New/updated Windows User Interface samples in the Windows SDK for Windows 7

Sample

Description

Install Location

WinUI ChooseFont Sample

Demonstrates how to use the ChooseFont with flags for Windows 7.

winui\ChooseFont

WinUI: CWMFEx Sample

Demonstrates how to use the RegisterHotKey function with MOD_NOREPEAT to avoid generating multiple hotkey notifications when the user-defined 'b'+ ALT hotkey is being repeatly pressed.

winui\CWMFEx

Location API Gadget sample

Demonstrates how to use the Location Platform to retrieve the current location and display that on a map.

WinUI\Location\LocateMe.gadget

Location API eventing sample

Demonstrates how to access the Location Platform in an asynchronous (event driven) manner.

WinUI\Location\LocationEvents

Location API SetLocation Sample

Demonstrates how to set the default location using the Location API. This sample requires Visual Studio to be built.  This sample must be run as administrator for the call to IDefaultLocation::SetReport to succeed.   This application retrieves the default civic address that is specified in Control Panel, and prints its fields. It then prompts the user to change the default civic address in Control Panel, prints the new values, and then sets the default location back to its original.

winui\Location\SetLocation

Location API Simple Location sample

Simple Location Demonstrates how to access the Location Platform in a synchronous manner.

WinUI\Location\SimpleLocation

WinUI: RegisterHotKey Sample

Demonstrates how to use the RegisterHotKey function with MOD_NOREPEAT to avoid generating multiple hotkey notifications when the user-defined 'b'+ ALT hotkey is being repeatly pressed.

winui\RegisterHotKey

Ambient Light Aware Sample

Demonstrates how to use the Sensor Platform by reading data from Ambient Light Sensors on the computer and changing a label's font size to be optimized for the reported light conditions.

WinUI\Sensors\AmbientLightAware

ChangeNotifyWatcher Sample

Demonstrates the ShellChangeNotify system.

winui\shell\AppPlatform\ChangeNotifyWatcher

Using and extending Common File Dialog

Demonstrates the use of the different Common File Dialog APIs (IFileDialog, IFileSaveDialog, and associated interfaces) to create a custom file open/save dialog.  Build and run CommonFileDialogSDKSample.exe and play with the File menu to see it in action.

WinUI\Shell\AppPlatform\CommonFileDialog

Common File Dialog Modes Sample

Demonstrates how to use the Common File Dialog in different modes to pick files, containers (folders) or multiple items in a “basket” mode without dismissing the dialog. This sample also demonstrates how to use the Common File Dialog to pick both files and folders from the same dialog in “basket” mode.

winui\Shell\AppPlatform\CommonFileDialogModes

DragDrop Visuals Sample

 Demonstrates how to use the shell drag drop services to get the presentation features that shell drag drop supports for both targets and sources.   This includes:  1) drop targets rendering the drag image  2) drop target provided drop tips  3) drag source populating the drag image information when using a custom data object  4) drag source enable drop tips  5) use the shell provided IDropSource implementation by calling SHDoDragDrop(). This handles many of the edge cases for you dealing with different types of targets

winui\Shell\AppPlatform\DragDropVisuals

Execute in Explorer Sample

Demonstrates how to perform a ShellExecute in the Explorer Process. This is most useful when you are an elevated process that you want to run in an unelevated. The Windows Explorer runs unelevated most of the time so applications can use this code to take advantage of that.

winui\Shell\AppPlatform\ExecInExplorer

Explorer Browser Search Sample

Demonstrates how to use the Explorer Browser control to embed Windows Explorer in an application. It then demonstrates how to simply implement instant search functionality with an in-memory search folder.

winui\shell\AppPlatform\ExplorerBrowserSearch

FileIsInUse

Implemenets the IFileIsInUse interface.  See the included docx file for a complete description.

winui\Shell\AppPlatform\FileIsInUse

FileOperations

Demonstrates the use of the file operation API for performing actions such as copy/move/delete/rename on file system objects.

WinUI\Shell\AppPlatform\FileOperations

KnownFolders Sample

Demonstrates registering a KnownFolder by directly writing the relevant registry keys and values.  This sample showcases only the most common KnownFolder Definition fields and targets developers of managed code who would prefer registry access to COM interop.

WinUI\Shell\AppPlatform\KnownFolders

NamespaceTreeControl Sample

Demonstrates how to implement a custom namespace tree control

WinUI\Shell\AppPlatform\NamespaceTreeControl

Parsing With Parameters Sample

Demonstrates how to take advantage of shell helpers that use the parsing name interact with items via the shell programming model.

winui\Shell\AppPlatform\ParsingWithParameters

PropertyEdit Sample

Demonstrates how to use the Property System APIs to read and write values to and from files. You can try this sample for reading/writing files on file types including .jpg, .tiff, .doc, .mp3, .wma files. (and more if they have property handlers associated with them.) You can also use this sample in conjunction with the Recipe Property Handler sample which Demonstrates a sample property handler for .recipe file to debug that handler.  Usage: propertyedit [OPTIONS] [Filename]  Options:  -get <PropertyName>   Get the value for the property defined                        by its Canonical Name in <propertyName>  -set <PropertyName>   Set the value for the property defined       <PropertyValue>    by <PropertyName> with value <PropertyValue>  -enum                 Enumerate all the properties.  -info <PropertyName>  Get schema information on property.  Examples: PropertyEdit -get “System.Author” foo.jpg PropertyEdit -set “System.Author” “John Doe” foo.jpg PropertyEdit -enum foo.jpg PropertyEdit -info “System.Author” 

WinUI\Shell\AppPlatform\PropertyEdit

Property Schema API sample

Demonstrates the use of the different Property System APIs to register/unregister custom property schemas, or get detailed information about properties alredy registered with the system.  Run PropSchema.exe without any arguments to see usage information.

WinUI\Shell\AppPlatform\PropertySchemas

SearchFolder Sample

Demonstrates the use of ISearchFolderItemFactory API to create search folders.  Build and run SearchFolder.exe to it in action.

WinUI\Shell\AppPlatform\SearchFolder

Shell Library Backup Sample

Demonstrates how to pick and interact with libraries as containers. ShellLibraryBackup is a fictional backup application that supports picking and backing up libraries in addition to folders. Libraries are the new storage location for user files in Windows 7. The Documents, Pictures, Music and Videos libraries provide a superset of functionality to users and they look a little different when discovered programmatically.

winui\Shell\AppPlatform\ShellLibraryBackup

Shell Library Command Line Sample (shlib.exe)

Sample command-line interface for the IShellLibrary interface, providing programmatic access to inspect and manipulate Windows libraries files from the console.

winui\Shell\AppPlatform\ShellLibraryCommandLine

Shell Storage Sample

Demonstrates how to use the IStorage and IStream APIs to create files and folders in shell containers like libraries or any container picked from either the folder picker dialog or the SHBrowseForFolder dialog. Also demonstrates how to save directly to to the shell item returned from the file dialog using these APIs.

winui\Shell\AppPlatform\ShellStorage

UsingImageFactory Sample

Demonstrates the use of IShellItemImageFactory API to create file icons from existing image files.

winui\shell\AppPlatform\UsingImageFactory

UsingThumbnailProviders Sample

Demonstrates how to call the IThumbnailProvider methods to retrieve a thumbnail for an image file.

winui\shell\AppPlatform\UsingThumbnailProviders

Shell: AppUserModelIDWindowProperty

Demonstrates how to control the taskbar grouping behavior of an application's windows by setting the AppUserModelID on a window via the use of the IPropertyStore implementation for windows, obtained via SHGetPropertyStoreForWindow.

winui\shell\AppShellIntegration\AppUserModelIDWindowProperty

Automatic Jump List sample

Demonstrates how to utilize the automatic Jump Lists in Windows 7, which are generated from information provided through SHAddToRecentDocs.  Also Demonstrates how to set an application's jump list to show the Frequent category instead of Recent.

WinUI\Shell\AppShellIntegration\AutomaticJumpList

CreateProcess Verb Sample

This demonstrates how implement a shell verb using the CreateProcess method CreateProcess based verbs depend on running a .exe and passing it a command line. This method is not as powerful as the DropTarget and DelegateExecute methods but it does achieve the desirable out of process behavior.

winui\Shell\AppShellIntegration\CreateProcessVerb

Custom Jump List Sample

Demonstrates how to customize the Jump List for an application using ICustomDestinationList.

WinUI\Shell\AppShellIntegration\CustomJumpList

DropTarget Verb Sample

Demonstrates how implement a shell verb using the DropTarget method this method is prefered for verb implementations that need to work on Windows XP as it provides the most flexibility, it is simple, and supports out of process activation.   This sample implements a stand alone local server COM object but it is expected that the verb implementation will be integreated into existing applications. To do that have your main application object register a class factory for itself and have that object implement IDropTarget for the verbs of your application. Note that COM will launch your application if it is not already running and will connect to an already running instance of your application if it is already running. These are features of the COM based verb implementation methods.

winui\Shell\AppShellIntegration\DropTargetVerb

Execute Command Verb Sample

Demonstrates how implement a shell verb using the ExecuteCommand method. This method is preferred for verb implementations as it provides the most flexibility, it is simple, and supports out of process activation. This sample  implements a standalone local server COM object but it is expected that the verb implementation will be integrated  into existing applications. to do that have your main application object register a class factory for itself and have that object implement IDropTarget for the verbs of your application. Note that COM will launch your application if it is not already running and will connect to an already running instance of your application if it is already running. These are features of the COM based verb implementation methods.

winui\Shell\AppShellIntegration\ExecuteCommandVerb

Explorer Command Verb Sample

Demonstrates how implement a shell verb using the ExplorerCommand method.

winui\shell\AppShellIntegration\ExplorerCommandVerb

Shell: HomeGroup Sample

Demonstrates how to determine homegroup membership status, enumerate top level items in the HomeGroup Shell Folder, and launch the HomeGroup Sharing Wizard.

winui\shell\AppShellIntegration\HomeGroup

Ideal Property Handler

Demonstrates the implementation of an ideal property handler for an OleDoc File Format (.docfile-ms) or a fictional OpenMetadata format (.openmetadata-ms) which supports reading and writing properties and custom schema.

winui\Shell\AppShellIntegration\IdealPropertyHandler

NonDefaultDropMenuVerb Sample

Demonstrates how to extend the non-default drag-and-drop context menu.

winui\shell\AppShellIntegration\NonDefaultDropMenuVerb

Shell: NotificationIcon Sample

Demonstrates how to use the Shell_NotifyIcon and Shell_NotifyIconGetRect APIs to display a notification.

winui\shell\AppShellIntegration\NotificationIcon

Player Verb Sample

Demonstrates how to create a verb that operates on shell items and containers to play items or add items to a queue. Particularly useful for media applications.

winui\Shell\AppShellIntegration\PlayerVerbSample

Playlist Creator Sample

Demonstrates how to create a verb that operates on shell items and containers. In this case, the verb creates a playlist from the selected item or container.

winui\Shell\AppShellIntegration\PlaylistCreator

Playlist Property Handler

Demonstrates the implementation of a property handler for the .WPL and .ZPL playlist file formats.

winui\Shell\AppShellIntegration\PlaylistPropertyHandler

Recipe Preview Handlers

Demonstrates the use of the different Preview handler APIs to register a preview handler COM servers for custom file types.  These API provide a mechanism to expose “live” content of files in the Preview Pane of Explorer.  Build and register the dll.  Navigate into the Recipes folder, enable Preview Pane in Explorer, and select a .recipe file to see live contents of the file show up in the Preview Pane.

WinUI\Shell\AppShellIntegration\RecipePreviewHandler

Recipe Property Handler

This sample Demonstrates the creation of a sample property handler for an XML based .recipe file format. It supports Open Metadata. (handles all properties given to it by saving under <ExtendedProperties> section of the XML file)

winui\Shell\AppShellIntegration\RecipePropertyHandler

Sync and Share Verbs

Demonstrates how to register a verb that extends the “Sync” and “Share” verbs in the Windows Explorer Command Bar.

winui\Shell\AppShellIntegration\SyncAndShareVerbs

Shell: TabThumbnails

Demonstrates how an application can expose multiple switch targets (as for tabs) on the taskband and how to provide their thumbnails.

winui\shell\AppShellIntegration\TabThumbnails

Desktop Integration sample

Demonstrates how to show peripheral status in the taskbar for an application window. Demonstrates both overlay icons and progress bars.

winui\shell\AppShellIntegration\TaskbarPeripheralStatus

Windows 7 Taskbar Integration sample

Demonstrates how to add a thumbnail toolbar and respond to its commands.

winui\Shell\AppShellIntegration\TaskbarThumbnailToolbar

Drawing text on glass using Buffered Paint Theming APIs

Drawing text on glass using Buffered Paint Theming APIs

WinUI\Shell\AppShellIntegration\TextOnGlassBuffered

Shell AppBar

Demonstrates how to implement an application desktop toolbar that is resizable, can attach to any side of the screen, and allows itself to be hidden in the same way the Explorer taskbar automatically hides.

winui\Shell\LegacySamples\AppBar

Shell Fakemenu

Demonstrates how an application can display a window that behaves in a similar manner as a menu.

winui\Shell\LegacySamples\Fakemenu

Building glass enabled deskbands

Demonstrates the use of the different DeskBand API APIs to create a custom desk band.  Build and register DeskBandSDKSample.dll and right-click on the Task Bar, expand “Toolbars” menu option and choose “DeskBand Sample”.  You will see the newly created Desk Band show up on the Task Bar.

WinUI\Shell\ShellExtensibility\DeskBands

OpenSearch Sample

Demonstrates a custom federated search provider with Visual Studio 2008 that connects to the AdventureWorks database.   Uses ASP.NET to create a custom federated search provider. Queries are federated from Windows to the search provider using the OpenSearch standard. Results from this federated search provider are enumerated in the Windows Explorer as rich items in the view. Windows 7 understands search results that are returned in the RSS format. Other systems that support OpenSearch are compatible with Windows 7 federated search sources like Microsoft Search Server 2008 and other RSS-enabled clients. 

winui\shell\ShellExtensibility\OpenSearch

Sidebar: IDesktopGadget Sample

Demonstrates how to add a gadget programmatically.

winui\sidebar\IDesktopGadget

Gadgets: sdk_graphicsapi.gadget Sample

Demonstrates key functionality the Windows Desktop Gadgets graphics library, for both text and images.

winui\sidebar\sdk_graphicsapi.gadget

SideShow Alarms Sample

Demonstrates a application that sends notifications to a Windows SideShow-compatible device. The application registers with the platform and sends notifications based on user specified alarm times. Output: The application should open a window titled 'My Alarm' and allow you to set an alarm time. When the alarm time elapses, a notification is shown on the device.

Winui\sideshow\Alarms

SideShow HelloWorld Sample

Demonstrates the creation of a simple Windows SideShow application. The application registers with the Simple Content Endpoint and pre-loads or sends a page with the string ‘Hello World’ to the device.

Winui\sideshow\HelloWorld

SideShow Pictures Sample

Demonstrates the sending of pictures / images from a file to an Windows SideShow device. The application takes jpeg images from the Pictures directory and sends them to the device to be viewed.

Winui\sideshow\Pictures

SideShow Tasks Sample

Uses the events and the Simple Content Format more extensively. The sample application gets its data from the TaskList.xml file in the sample folder. It uses the ContentMissing event to send content to the device.

Winui\sideshow\tasks

Simple UI Automation Provider sample

Demonstrates how to implement UI Automation on a simple custom control.

WinUI\UIAutomation\SimpleUIAProvider

Windows Ribbon: ContextPopup sample

Demonstrates the markup and code required to implement a Windows Ribbon application with various ContextPopups, with options to output Ribbon framework callbacks to a console window.

winui\WindowsRibbon\ContextPopup

Windows Ribbon: DropDownColorPicker sample

Demonstrates the markup and code required to use a Windows Ribbon DropDownColorPicker control.

winui\WindowsRibbon\DropDownColorPicker

Windows Ribbon: FontControl sample

Demonstrates the markup and code required to implement a FontControl within a Windows Ribbon application, with options to output various Ribbon Framework callbacks to a console window.

winui\WindowsRibbon\FontControl

Windows Ribbon: Gallery sample

Demonstrates the markup and code required to use the different types of Gallery controls included in the Windows Ribbon framework.  The sample includes code that can be used to dynamically populate items into the Galleries, and handle special Gallery previewing events that support Results-oriented UI.  The sample also demonstrates how to create a Ribbon application that works properly in high DPI modes.

winui\WindowsRibbon\Gallery

Windows Ribbon: HTMLEditRibbon sample

Demonstrates markup and code required to migrate an existing MFC application to use the Windows Ribbon.

winui\WindowsRibbon\HTMLEditRibbon

Windows Ribbon: SimpleRibbon sample

Demonstrates the markup and code required to implement a very simple Win32 application with a Windows Ribbon.

winui\WindowsRibbon\SimpleRibbon

Windows Search Command Line

Windows Search Command Line Utility console application to query the Windows Search index like FINDSTR /S and DIR /S

winui\WindowsSearch\DSearch

SearchEvents Sample

Demonstrates how to implement and use the IRowsetEvents interface to monitor changes to items belonging to a query over a particular scope.  This demo also Demonstrates how to use the IRowsetPrioritization interface to set the indexing speed and priority of items also belonging to that scope.

winui\WindowsSearch\SearchEvents

Structured Query Code Sample

Demonstrates the Structured Query APIs. This sample program reads lines from the console, parses them using the system schema, and displays the resulting condition trees.

winui\WindowsSearch\StructuredQuerySample

Windows Search with OleDB

Demonstrates how to query Windows Search or Windows Desktop Search using OleDB and C++

winui\WindowsSearch\WSOleDB

 

Karin Meier-Magruder

Program Manager for Samples

Windows SDK Team