Windows Presentation Foundation Avalon Integrating With Your Win





















- Slides: 21
Windows Presentation Foundation ("Avalon"): Integrating With Your Win 32/MFC Application Nick Kramer PRS 313 Lead Program Manager Microsoft Corporation 1
How Do I Get There From Here? Do I rewrite everything? Too much code to rewrite Existing plug-ins Existing controls Existing documents 2
Integration! Can use WPF with existing code WPF inside existing code Existing code inside WPF Integrate at the component level Maximum richness => all WPF 3
Rewrite Or Evolve? 4
Hwnd. Source and Hwnd. Host WPF inside hwnd = Hwnd. Source hwnd inside WPF = Hwnd. Host Hwnds can be: Pure Win 32, Direct. X, MFC, GDI+, etc. 5
WPF inside hwnd Hwnd. Source makes WPF look like a big hwnd Hwnd. Source source = new Hwnd. Source(…); source. Root. Visual = my. Wpf. Stuff; HWND hwnd = source. Handle; 6
WPF inside hwnd 7
hwnd inside WPF Hwnd. Host makes hwnd look like a WPF control class My. Hwnd. Host : Hwnd. Host { override Build. Window. Core(hwnd. Parent) { return Create. Window. Ex(…); } } 8
Direct. X inside WPF 9
Mixed App Considerations Higher long-term cost, lower initial cost Run in browser Integrate your business logic Using XAML in C++ Airspace & layered windows 10
Airspace Each pixel belongs to one hwnd File Edit View Help Win 32 WPF Direct. X 11
Airspace – caution! File Edit View Help Win 32 WPF Direct. X 12
Layered windows WPF fully supports HRGNs WPF does not support layered windows (WS_EX_LAYERED) 13
Mixed Application Ideas New chrome Faster New canvas? 14
Mixed Application Ideas Wizards and help systems Generate HTML => Generate XAML WPF wrapper around an existing control 15
WPF inside MFC 16
Summary Can use WPF with existing code Maximum richness => all WPF Integration is for components 17
Info on hwnd integration System. Windows. Hwnd. Host System. Windows. Hwnd. Source Article: Migration and Interop Architecture WPF newsgroup microsoft. public. windows. developer. winfx. avalon http: //blogs. msdn. com/nickkramer/ nkramer@microsoft. com 18
Information on C++ and managed code http: //msdn. microsoft. com/visualc/ http: //forums. microsoft. com/msdn/default. a spx? Forum. Group. ID=8 microsoft. public. vc. language http: //msdn. microsoft. com/visualc/using/mu ltimedia/newc/ http: //blogs. msdn. com/nikolad/ 19
Related PDC Talks (PRS 321) Windows Forms: Integrating Windows Forms and WPF (FUN 318) Windows Vista: A Case Study Using Win 32/Win. FX Integration to Light-Up Your Win 32 Application on Windows Vista (PRS 324) WPF: Using Data in Your WPF Applications (PRS 330) WPF: Creating Rich Content Experiences in Your Applications Related PDC Hands-on Labs Moving Win 32 Applications to WPF Integrating MFC and Windows Forms 20
© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. 21