bringing existing c++ code to windows store apps

22
Bringing Existing C++ Code to Windows Store Apps Tarek Madkour Group Program Manager – Visual C+ + 3-000

Upload: vincent-ford

Post on 31-Dec-2015

26 views

Category:

Documents


0 download

DESCRIPTION

Bringing Existing C++ Code to Windows Store Apps. Tarek Madkour Group Program Manager – Visual C++ 3-000. Agenda. Key Differences APIs WinRT Wrapping Demo. What’s Different?. New user interface New APIs API restrictions Performance Responsiveness. New user experience - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Bringing Existing C++ Code to Windows Store Apps

Bringing Existing C++ Code to Windows Store AppsTarek MadkourGroup Program Manager – Visual C++

3-000

Page 2: Bringing Existing C++ Code to Windows Store Apps

Key DifferencesAPIsWinRT WrappingDemo

Agenda

Page 3: Bringing Existing C++ Code to Windows Store Apps

What’s Different?

New user experienceTouch-friendlyTrustBattery-powerFast and fluid

New user interfaceNew APIsAPI restrictionsPerformanceResponsiveness

Page 4: Bringing Existing C++ Code to Windows Store Apps

User InterfaceYour app needs new UI- Touch-friendly- Snaps & scales- Participates in contracts

DirectX for C++ appsXAML for C++ and .NET appsHTML5 for Java Script apps

Visual Studio 2012 has great tools for Windows 8 UI development

Page 5: Bringing Existing C++ Code to Windows Store Apps

API RestrictionsOnly a subset of Win32 and COM APIs are availableNew replacements available for most APIsRestricted API usage will result in:• Runtime failures• Rejection from Windows StoreRestriction applies to app code … and packaged 3rd party libraries

Page 6: Bringing Existing C++ Code to Windows Store Apps

API Restrictions: What to expect?UI: MFC, GDI

UI: DirectX still need to rethink user experience

ISO C++

VC++ Runtime (CRT, PPL, …)

C++/CLI

OS / Win32 WinRT + Win32 subset

COM / ATL ATL subset

3rd party libraries it depends

Everything else it depends

View

Model

Other

Page 7: Bringing Existing C++ Code to Windows Store Apps

API Restrictions: What to do?Preferred: Use the Windows Application Certification Kit• Run it on the original binaries• The generated API list is your “to do” list• The VS IDE can help find all references to APIs

in your list

Not Recommended: Use the pre-processor• Set the WINAPI_FAMILY_PARTITION macro• Work through the compiler errors

Page 8: Bringing Existing C++ Code to Windows Store Apps

Demo: Windows App Cert Kit

Page 9: Bringing Existing C++ Code to Windows Store Apps

API Restriction: Threading ExampleThreading is key to performance and battery usage

Needed to strike a tough balance between:• Great user experience• Advanced usage• Compatibility

Result: the code example on this slide will not work

Page 10: Bringing Existing C++ Code to Windows Store Apps

API Restriction: Threading ExampleAvailable options for Windows Store apps:WinRT ThreadPool (namespace: Windows::System::Threading)

• Tailored for Windows Store app performance• Available only for Windows Store apps (not on Desktop)

Parallel Patterns Library Tasks• Higher level of abstraction• Available for both Windows Store and Desktop apps

ISO C++: std::thread, std::future• Low level of abstraction• Available cross-platform

Page 11: Bringing Existing C++ Code to Windows Store Apps

API Restriction: File I/O ExampleApplication Isolation is essential for Windows Store appsDefault access is restricted only to application dataApp manifest can request a few more permissionsAvailable options for Windows Store apps:WinRT Storage APIs • namespace: Windows::Storage

ISO C++• <fstream>, <filesystem>, …

Page 12: Bringing Existing C++ Code to Windows Store Apps

New APIs: WinRT

Devices

SensorsGeolocation Portable NFC

Communications & Data

Contracts

XML

Web

SMSNetworking

Notifications

Local & Cloud Storage

Streams

Background Transfer

User Interface

HTML5/CSS XAML DirectX Controls

Input Accessibility Printing

Data Binding

TilesSVG

FundamentalsApplication

ServicesAuthentication Cryptography GlobalizationMemory ManagementThreading/Timers

MediaVisual EffectsPlayback PlayToCapture

Page 13: Bringing Existing C++ Code to Windows Store Apps

New APIs: Asynchronous PatternCommon pattern for WinRT APIsImportant for creating smooth experiencesVery common pattern among key WinRT APIsFavors non-blocking scenariosProvides you the control over when to block if needed

Page 14: Bringing Existing C++ Code to Windows Store Apps

Async: Basic Pattern

Page 15: Bringing Existing C++ Code to Windows Store Apps

Async: Example

Page 16: Bringing Existing C++ Code to Windows Store Apps

WinRT ComponentsGreat for interoperating with Java Script and .NET apps• ... if you are a multi-language app developer• … if you are a library vendor seeking wider

exposure

C++/CX (or WRL) at the boundary to expose WinRT typesMaintain or change the C++ interfaceExtension SDKs make consumption from VS projects easier

Page 17: Bringing Existing C++ Code to Windows Store Apps

WinRT Components

Existing C++ Code

WinRT Wrapper

Java Script C# / VB (.NET) C++

DLL WinMD

Page 18: Bringing Existing C++ Code to Windows Store Apps

Demo: Putting it all together

Page 19: Bringing Existing C++ Code to Windows Store Apps

Rethink your app user experienceYour C++ code will move forward3rd party libraries need attentionNew world of WinRT available to you

Your existing investment in C++ code is very valuable in the new world of Windows Store applications.

Conclusion

Page 20: Bringing Existing C++ Code to Windows Store Apps

Related Sessions

• Tue 2:15 The Power of C++ Project Austin

• Tue 5:45 Connecting C++ Apps to the Cloud via Casablanca

• Wed

11:15

All About Performance

• Wed

1:45 DirectX Graphics Development

• Wed

5:15 Diving Deep Into C++/CX and WinRT

• Thu 10:15

Building Windows Store Apps using XAML and C++

• Fri 12:45

The Future of C++

Page 22: Bringing Existing C++ Code to Windows Store Apps

© 2012 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.