Bringing Existing C++ Code to Windows Store Apps
-
Upload
vincent-ford -
Category
Documents
-
view
26 -
download
0
description
Transcript of Bringing Existing C++ Code to Windows Store Apps
![Page 1: Bringing Existing C++ Code to Windows Store Apps](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/1.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/2.jpg)
Key DifferencesAPIsWinRT WrappingDemo
Agenda
![Page 3: Bringing Existing C++ Code to Windows Store Apps](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/3.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/4.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/5.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/6.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/7.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/8.jpg)
Demo: Windows App Cert Kit
![Page 9: Bringing Existing C++ Code to Windows Store Apps](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/9.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/10.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/11.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/12.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/13.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/14.jpg)
Async: Basic Pattern
![Page 15: Bringing Existing C++ Code to Windows Store Apps](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/15.jpg)
Async: Example
![Page 16: Bringing Existing C++ Code to Windows Store Apps](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/16.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/17.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/18.jpg)
Demo: Putting it all together
![Page 19: Bringing Existing C++ Code to Windows Store Apps](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/19.jpg)
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](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/20.jpg)
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 21: Bringing Existing C++ Code to Windows Store Apps](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/21.jpg)
Visual C++ Bloghttp://blogs.msdn.com/b/vcblog/
Windows Dev Centerhttp://msdn.microsoft.com/en-us/windows/apps
Channel9 GoingNativehttp://channel9.msdn.com/Shows/C9-GoingNative
MSDN Forumshttp://social.msdn.microsoft.com/Forums/en-US/category/windowsapps
User Research Feedbackhttp://bit.ly/x6dtHt
Resources
![Page 22: Bringing Existing C++ Code to Windows Store Apps](https://reader035.fdocuments.us/reader035/viewer/2022062321/56812cad550346895d915d68/html5/thumbnails/22.jpg)
© 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.