Developing with the windows api code pack for net framework
This presentation is the property of its rightful owner.
Sponsored Links
1 / 38

Developing with the Windows API Code Pack for .NET Framework PowerPoint PPT Presentation


  • 110 Views
  • Uploaded on
  • Presentation posted in: General

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

Download Presentation

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


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


Developing with the windows api code pack for net framework

Microsoft Confidential


Agenda

Agenda

  • Why are we here?

  • The Windows API Code Pack

    • Introduction

    • Demos DemosDemos…

    • Roadmap


Why are we here part i

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…


Great windows applications

Great Windows Applications

Demo


Why we are here part ii

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


Accessibility from managed code

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


What is windows api code pack

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


New windows api code pack version

New Windows API Code Pack Version

announcing

Version 1.0.1


Windows api code pack shell

Windows API Code packShell

  • Taskbar

  • Libraries

  • Explorer Browser

  • Known Folders

  • Task Dialogs

  • Shell Properties


Windows taskbar features

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


Customizing the jump list adding tasks

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);


Creating thumbnail toolbars

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)


Customizing live thumbnails

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)


Creating thumbnail toolbars1

Creating Thumbnail Toolbars

WinForms

AddButtons(IntPtrwindowHandle,

params

ThumbnailToolbarButton[] buttons)

WPF:

AddButtons(UIElementcontrol,

params

ThumbnailToolbarButton[] buttons)


Setting overlay icon

Setting Overlay Icon

WinForms

TaskbarManager.SetOverlayIcon(

IntPtrwindowHandle,

System.Drawing.Iconicon,

string accessibilityText)

WPF

TaskbarManager.SetOverlayIcon(

System.Windows.Window window,

System.Drawing.Iconicon,

string accessibilityText)


Taskbar

Taskbar

Demos

JumpLists, Thumbnail Buttons, Clipping, and custom Preview


Shell and libraries integration

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


Customizing live thumbnails1

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);


Libraries

Libraries

Demo


Windows sensor and location platform

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


Ambient light sensor

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


Msdn reader

MSDN Reader

Demo

Light-Aware User Interface


Xna racing game

XNA Racing Game

Demo

Ambient Light and Accelerometer Sensors


Many more topics

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


Windows 7 managed roadmap

Windows 7 Managed Roadmap

Today

Tomorrow


Windows api code pack roadmap

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


Call to action

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


Resources

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


Developing with the windows api code pack for net framework

YOUR FEEDBACK IS IMPORTANT TO US!

Please fill out session evaluation forms online at

MicrosoftPDC.com


Learn more on channel 9

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


Windows 7 taskbar and wpf 4

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


Taskbar using xaml

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>


  • Login