1 / 38

Developing with the Windows API Code Pack for .NET Framework

CL12. Developing with the Windows API Code Pack for .NET Framework. Yochay Kiriaty Technical Evangelist Microsoft Corporation. Agenda. Why are we here? The Windows API Code Pack Introduction Demos Demos Demos … Roadmap. Why Are We Here? (Part I).

cutler
Télécharger la présentation

Developing with the Windows API Code Pack for .NET Framework

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CL12 Developing with the Windows API Code Pack for .NET Framework Yochay Kiriaty Technical Evangelist Microsoft Corporation

  2. Microsoft Confidential

  3. Agenda • Why are we here? • The Windows API Code Pack • Introduction • Demos DemosDemos… • Roadmap

  4. Why Are We Here? (Part I) • We all write Windows Client applications • Windows 7 has some cool features • Taskbar • Shell and Libraries • Sensor and Location • Multitouch • New DirectX • Etc…

  5. Great Windows Applications Demo

  6. Why We Are Here? (Part II) • We all write Windows Client applications • Windows 7 has some cool features • All these features expose a native (win32) API • Today - there are no equivalent Managed APIs available to developers in the .NET Framework • “Interoping” with Unmanaged Code might be a little difficult sometimes

  7. Accessibility from managed code Easy • Directly-callable using. NET interop mechanisms • Example: RSS, Office • C++/CLI or PInvoke signatures • Example: Application Recovery and Restart • Raw Win32 • Examples: Power Management, Windows Vista Wizards • COM • Examples: Search and Organize APIs • Extra difficult to call from managed code • Examples: Common File Dialogs, Network Awareness Hard

  8. What is Windows API Code Pack? • Managed class library to access to Windows (7) features • Windows Shell namespace (supporting for Shell property system) • Taskbar Jumplists, Icon Overlay, Progress bar, Thumbnail, etc… • Windows Task Dialogs , Explorer Browser and other controls • Direct3D 11.0 and DXGI 1.0/1.1 APIs • Sensor Platform APIs • Extended Linguistic Services APIs • Windows Restart Manager • Power APIs • Other…. • http://code.msdn.com/windowsAPICodePack

  9. New Windows API Code Pack Version announcing Version 1.0.1

  10. Windows API Code pack Shell • Taskbar • Libraries • Explorer Browser • Known Folders • Task Dialogs • Shell Properties

  11. Windows Taskbar Features Main Features • Overlay icons & progress bars • Jump lists (destinations, tasks) • Thumbnail toolbars • Custom thumbnails • Tabbed thumbnails Design Tip • Build a great Taskbar Icon • Forget about Quick Launch and the system tray

  12. Customizing the Jump ListAdding tasks IObjectCollection* poc = ...; IShellLink* task = ...; Poc->AddObject(task); ICustomDestinationList* pcdl = ...; Pcdl->BeginList(...); IObjectArray* poa = ... poc; Pcdl->AddUserTasks(poa); Pcdl->CommitList(); JumpListjl = ...; jl.AddUserTasks(paramsIJumpListTask[] tasks);

  13. Creating Thumbnail Toolbars UINT wm_tbc = RegisterWindowMessage( "TaskbarButtonCreated"); MSG m; GetMessage(..., &m); if (m.message == wm_tbc) { ITaskbarList3* ptl = ...; THUMBBUTTON btn = {...}; ptl->ThumbBarAddButtons(m.hWnd, 1, &btn); } WinForms: AddButtons(IntPtrwindowHandle, paramsThumbnailToolbarButton[] buttons) WPF: AddButtons(UIElement control, paramsThumbnailToolbarButton[] buttons)

  14. Customizing Live Thumbnails DwmSetWindowAttribute( ...,DWMWA_HAS_ICONIC_BITMAP,...); DwmSetWindowAttribute( ...,DWMWA_FORCE_ICONIC_REPRESENTATION,...); /* in the WndProc */ case WM_DWMSENDICONICTHUMBNAIL: HBITMAP hbm = ...; DwmSetIconicThumbnail(hwnd, hbm, ...); TabbedThumbnailManagerttm = ...; ttm.AddThumbnailPreview(TabbedThumbnail preview)

  15. Creating Thumbnail Toolbars WinForms AddButtons(IntPtrwindowHandle, params ThumbnailToolbarButton[] buttons) WPF: AddButtons(UIElementcontrol, params ThumbnailToolbarButton[] buttons)

  16. Setting Overlay Icon WinForms TaskbarManager.SetOverlayIcon( IntPtrwindowHandle, System.Drawing.Iconicon, string accessibilityText) WPF TaskbarManager.SetOverlayIcon( System.Windows.Window window, System.Drawing.Iconicon, string accessibilityText)

  17. Taskbar Demos JumpLists, Thumbnail Buttons, Clipping, and custom Preview

  18. Shell and Libraries Integration A library is a collection of folders • Folders are grouped together for a purpose • They don’t have to share a physical root Very useful and user-friendly Developer guidelines: • Use correct version of the Common File Dialog (CFD) • CFD may return a “library” as the saved location • A library has a default save location • There are APIs for syncing with libraries

  19. Customizing Live Thumbnails IShellLibrary *pIShelLibrary; HRESULT hr = SHCreateLibrary( IID_PPV_ARGS(&pIShelLibrary)); if (SUCCEEDED(hr)) { IShellItem *pIShellItem; SHAddFolderPathToLibrary(pIShelLibrary, L"C:\\Users\\Public\\Documents"); hr = pIShelLibrary->SaveInKnownFolder(FOLDERID_Libraries, L"My New Library", LSF_MAKEUNIQUENAME, &pIShellItem); pIShellItem->Release(); pIShelLibrary->Release(); } ShellLibrary library = new ShellLibrary(name, true) library.Add(folderPath);

  20. Libraries Demo

  21. Windows Sensor and Location Platform Develop better and more productive user experiences • Enable environmentally based applications Uniform APIs for working with sensors • No need to target vendor-specific APIs • Consistent interface for sensors, extensions for location • Access control and privacy • Application • Sensor API • UMDF Driver • Sensor Device

  22. Ambient Light Sensor Optimize for best user experience • Change screen brightness • Out of the box with Windows 7 Drive adaptive user interface • LCD displays are difficult to read outdoors in direct sunlight • Utilize knowledge of ambient lighting conditions to improve PC usability • Change contrast, color theme, and font size to be more readable in direct sunlight

  23. MSDN Reader Demo Light-Aware User Interface

  24. XNA Racing Game Demo Ambient Light and Accelerometer Sensors

  25. Many more topics • Managed class library to access to Windows (7) features • Windows Shell namespace (supporting for Shell property system) • Taskbar Jumplists, Icon Overlay, Progress bar, Thumbnail, etc… • Windows Task Dialogs, Explorer Browser and other controls • Direct3D 11.0 and DXGI 1.0/1.1 APIs • Sensor Platform APIs • Extended Linguistic Services APIs • Windows Restart Manager • Power APIs • Other…. • http://code.msdn.com/windowsAPICodePack

  26. Windows 7 Managed Roadmap Today Tomorrow

  27. Windows API Code Pack Roadmap Ver 2.0 Expanded Shell API coverage Ver - 0.9 Preview Ver – 1.0.1 Bug-fixes Ver 1.5 Fundamentals Ver - 1.0 Initial release Mar 2010 June 2009 Aug 2009 Nov 2009 Q2 / Q3 2010

  28. Call To Action • Windows 7 Application Compatibility • Optimize for Windows 7 • Use Windows 7 new Taskbar & jump lists • Become library aware • Manage files & data with libraries • Create Amazing Expereinces: • Enhance User Experience with Sensor and Location • Adopt the new DirectX Graphic APIs • Develop for Multitouch

  29. Resources • Windows Developer Center (MSDN) • http://msdn.microsoft.com/en-us/windows/default.aspx • Windows 7 Training Kit • Channel 9 - http://channel9.msdn.com/learn/windows • Windows 7 Developers Blog • http://windowsteamblog.com/blogs/developers/default.aspx • Windows 7 on Channel 9 • http://channel9.msdn.com/windows

  30. YOUR FEEDBACK IS IMPORTANT TO US! Please fill out session evaluation forms online at MicrosoftPDC.com

  31. Learn More On Channel 9 • Expand your PDC experience through Channel 9 • Explore videos, hands-on labs, sample code and demos through the new Channel 9 training courses channel9.msdn.com/learn Built by Developers for Developers….

  32. Windows 7 Taskbar and WPF 4 • XAML support for JumpLists • Supported • Overlay Icons and Progress Bar • JumpLists • Thumbnail Toolbars • Not Supported • Custom thumbnail and thumbnail Preview • Thumbnail clipping

  33. Taskbar using XAML • <JumpList.JumpList> • <JumpList> • <JumpTaskApplicationPath="notepad.exe" CustomCategory="External Tools" • Description="Take Notes" Title="Start Notepad" • IconResourcePath="notepad.exe" IconResourceIndex="0" /> • <JumpTaskApplicationPath="calc.exe" CustomCategory="External Tools" • Description="Perform some calculations" Title="Start Calculator" • IconResourcePath="calc.exe" IconResourceIndex="0" /> • </JumpList> • </JumpList.JumpList>

More Related