Download presentation
Presentation is loading. Please wait.
Published byEustacia Hines Modified over 5 years ago
1
The Windows API Code Pack: Add Windows 7 Features to Your Application
Tech Ed North America 2010 2/23/2019 6:28 PM Required Slide SESSION CODE: WCL316 The Windows API Code Pack: Add Windows 7 Features to Your Application Kate Gregory Gregory Consulting © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
2
Agenda What is different about Windows 7? Visuals Fundamentals
Taskbar jumplists Taskbar overlays – icons and progress bars Thumbnail buttons and custom thumbnails Fundamentals Power awareness Network awareness Libraries Restart and recovery
3
Accessibility from managed code
Directly-callable using. NET interop mechanisms Eg RSS, Office C++/CLI or PInvoke signatures Eg Application Recovery and Restart Raw Win32 Eg Power Management, Windows Vista Wizards COM Eg Search and Organize APIs Extra difficult to call from managed code Eg Common File Dialogs, Network Awareness Easy Hard
4
What is the Windows API Code Pack?
Managed class library to access to Windows 7 features Windows Shell namespace Windows Vista and Windows 7 Task Dialogs Support for Shell property system Taskbar Jump Lists, Icon Overlay and Progress bar Common file dialogs Direct3D 11.0 and DXGI 1.0/1.1 APIs Sensor Platform APIs Extended Linguistic Services APIs
5
Highlights from Windows API Code Pack
All demos are from the samples that ship with it All demos are provided in both VB and C# Samples are designed as a source of code for you But you would hardcode so much more Run the apps to experiment and see what you like
6
What You Will See Taskbar Jumplists Taskbar Overlays
Taskbar Thumbnail Buttons Restart and Recovery Power Management
7
DEMO Taskbar - Jumplists Tech Ed North America 2010 2/23/2019 6:28 PM
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
8
Taskbar Jumplists Private jumpList As JumpList
Tech Ed North America 2010 2/23/2019 6:28 PM Taskbar Jumplists Private jumpList As JumpList jumpList.AddToRecent(fileName) jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent category1 = new JumpListCustomCategory(“My Category 1") jumpList.AddCustomCategories(category1) category1.AddJumpListItems(New JumpListItem(path)) Dim p As String = Path.Combine(systemFolder, "notepad.exe") Dim ir As IconReference = New IconReference(p, 0) Dim jll As JumpListLink = New JumpListLink(p, "Open Notepad") jll.IconReference = ir jumpList.AddUserTasks(jll) © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
9
DEMO Taskbar - Overlays Tech Ed North America 2010 2/23/2019 6:28 PM
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
10
Tech Ed North America 2010 2/23/2019 6:28 PM Taskbar Overlays TaskbarManager windowsTaskbar = TaskbarManager.Instance windowsTaskbar.SetOverlayIcon(Me.Handle, My.Resources.Green, "Green") windowsTaskbar.SetProgressState( TaskbarProgressBarState.Error) windowsTaskbar.SetProgressValue( currentValue, maxValue) © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
11
Taskbar – Thumbnail Buttons and Clipping
Tech Ed North America 2010 2/23/2019 6:28 PM Taskbar – Thumbnail Buttons and Clipping DEMO © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
12
Taskbar Thumbnails buttonFirst = New ThumbnailToolbarButton(
Tech Ed North America 2010 2/23/2019 6:28 PM Taskbar Thumbnails buttonFirst = New ThumbnailToolbarButton( My.Resources.first, "First Image") AddHandler buttonFirst.Click, AddressOf buttonFirst_Click TaskbarManager.Instance.TabbedThumbnail. SetThumbnailClip(Me.Handle, New Rectangle(pictureBox1.Location, pictureBox1.Size)) © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
13
Restart and Recovery Register for Recovery Register for Restart
Chance to save your information on another thread OS calls your code for you Register for Restart OS will run your app again (with a hint) after it dies
14
DEMO Restart and Recovery Tech Ed North America 2010 2/23/2019 6:28 PM
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
15
Restart and Recovery ApplicationRestartRecoveryManager.
Tech Ed North America 2010 2/23/2019 6:28 PM Restart and Recovery ApplicationRestartRecoveryManager. RegisterForApplicationRestart( new RestartSettings("/restart", RestartRestrictions.None)); RecoveryData data = new RecoveryData( new RecoveryCallback(RecoveryProcedure), null); RecoverySettings settings = new RecoverySettings(data, 0); RegisterForApplicationRecovery(settings); © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
16
Power Management Is the machine running on battery?
What can your application do to extend battery life? Autosave less frequently Autosave before critical battery reached Scale back the user experience Graphics richness Reduce the frequency of data updates Stop spinning the CD for sound effects access Reduce CPU work loads Number of threads, thread priorities Use hardware (not software) rendering for graphics Turn off or constrain background processing Defer unnecessary tasks
17
DEMO Power Management Tech Ed North America 2010 2/23/2019 6:28 PM
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
18
Power Management PowerManager.PowerSourceChanged +=
Tech Ed North America 2010 2/23/2019 6:28 PM Power Management PowerManager.PowerSourceChanged += new EventHandler(PowerSourceChanged); PowerManager.PowerPersonality PowerManager.PowerSource PowerManager. GetCurrentBatteryState(). EstimatedTimeRemaining © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
19
Code Pack Gets managed developers working on Windows 7 now
WPF or Windows Forms C# or VB Not the only way to get there Some of this is in WPF (.NET 4) You could do your own interop, but why? Others have written other wrappers Documentation and samples Discussions on Code Gallery If you need to change or redistribute, you can
20
Windows API Code Pack Roadmap
June 2011 2.0 Expanded Shell API coverage 1.0 Initial release Aug 2009 1.0.5 cleanups Mid July 2010 1.0.1 Bug fixes Nov 2009 1.5 Fundamentals Jan 2011
21
Taskbar Restart and Recovery Power Awareness What you’ve seen
Jumplists – nouns and verbs Icon overlays Progress bar overlays Thumbnail buttons Thumbnail clipping Restart and Recovery Power Awareness
22
Call to Action Download Code Pack
Add functionality to your application so it lights up on Win 7 Feels like a Windows 7 app (taskbar etc.) Never lose unsaved data to a crash again Power efficiency and thoughtfulness
23
Required Slide Track PMs will supply the content for this slide, which will be inserted during the final scrub. Tech Ed North America 2010 2/23/2019 6:28 PM Track Resources Learn about Windows Client Development: Try out the Internet Explorer 9 Platform Preview: Interested in Windows hardware or software? Check it out: © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
24
Resources Learning Required Slide www.microsoft.com/teched
Tech Ed North America 2010 2/23/2019 6:28 PM Required Slide Resources Learning Sessions On-Demand & Community Microsoft Certification & Training Resources Resources for IT Professionals Resources for Developers © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
25
Complete an evaluation on CommNet and enter to win!
Tech Ed North America 2010 2/23/2019 6:28 PM Required Slide Complete an evaluation on CommNet and enter to win! © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
26
Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31st
You can also register at the North America 2011 kiosk located at registration Join us in Atlanta next year
27
Tech Ed North America 2010 2/23/2019 6:28 PM
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
28
Required Slide Tech Ed North America 2010 2/23/2019 6:28 PM
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.