Case Study- Porting an MFC Application to Unicode.ppt
《Case Study- Porting an MFC Application to Unicode.ppt》由会员分享,可在线阅读,更多相关《Case Study- Porting an MFC Application to Unicode.ppt(24页珍藏版)》请在麦多课文档分享上搜索。
1、 2000 Microsoft Corporation.,Case Study: Porting an MFC Application to Unicode,Harley Rosnow Software Development Lead Microsoft Corporation, 2000 Microsoft Corporation.,Table of Contents,Assumptions and Terminology Two-Executable Model FrontPage 10 Objectives Microsoft Foundation Classes FrontPage
2、10 Strategy Unicode Strings FrontPage 2000 User Interface FrontPage 10 User Interface Achieving a Mixed Unicode and ANSI Execution Environment with MFC Unicode and ANSI windows and messages described,How do messages travel to a window in MFC? How can we allow Unicode messages to survive ANSI MFC? Co
3、nclusions and Relevance Futures Contributors, References and Contact Info Q & A, 2000 Microsoft Corporation.,Assumptions and Terminology,A familiarity with technical topics: C+ programming Windows programming MFC programming Some terms: ANSI (A) used for code that stores and manipulates data using c
4、ode pages Wide (W) used for code and APIs that support Unicode data UI user interface the appearance and implementation of all windows and user interactions ACP active code page the default system code page used to store most data on Windows 9x including file names. Retained on Windows NT for ANSI a
5、pplication compatibility FrontPage 10 the official name of this release has not yet been determined, so were using this name since this version of FrontPage ships with the 10th release of Microsoft Office., 2000 Microsoft Corporation.,Two-Executable Model,Established by the operating systems group a
6、t Microsoft and basis for Microsoft development tools. Use UNICODE define to create a Unicode version of your software. Unicode version fully functional only on Windows NT/2000. ANSI version fully functional on both Windows 9x and NT/2000, but cannot manipulate Unicode data. UNICODE define controls
7、the APIs called (SendMessageW vs SendMessageA), data structure definitions and the representation of strings (“help” vs L”help”)., 2000 Microsoft Corporation.,FrontPage 10 Objectives,A single World-Wide Office executable: Fully functional on both Windows 9x and Windows NT/2000 Manipulate Unicode dat
8、a internally Takes advantage of OS capabilities: Typing, displaying of Unicode characters and storing of Unicode file names on Windows NT/2000 Displaying Unicode surrogate characters on Windows 2000 Typing and display of multiple codepage data on Windows 9x Convert to ANSI code pages as required by
9、Windows 9x on the periphery Dont abandon MFC; dont rewrite app, 2000 Microsoft Corporation.,Microsoft Foundation Classes (MFC),Object oriented programming model on top of the native OS windowing architecture Set of C+ classes wrapping Win32 APIs Follows the two-executable model: mfc42.dll and mfc42u
10、.dll. Two application compilations: All classes (CString, CWnd, etc.) either store, pass and manipulate Unicode data or ANSI code page data. Very flexible allows the application developer to override and specialize almost all behaviors., 2000 Microsoft Corporation.,FrontPage 10 Strategy,Create an ex
11、ecution environment with a mixture of ANSI and Unicode data, messages and windows Leave MFC as ANSI and dynamically link to mfc42.dll Override the MFC classes to use Unicode data Implement our own alternative classes where required Take advantage of Unicode facilities supporting all Windows platform
12、s Write our own code to support Unicode on Win9x Convert data to the active code page as a last resort, 2000 Microsoft Corporation.,Unicode Strings,Abandoned MFCs CString. Implemented a new Unicode string class, CWString: Method compatible with CString, but with Unicode arguments and return values.
13、Use the ANSI-standard Unicode C/C+ runtime library routines instead of the Win32 versions. Use MSO routines supporting all Windows platforms. Implemented custom resource loading, formatting routines, etc. which retains Unicode data on Windows 9x. Redefined all Unicode routines that dont support Wind
14、ows 9x, so code using them wont compile., 2000 Microsoft Corporation.,FrontPage 2000 User Interface,Custom Views,Common Controls: Trees, Lists, StatusBar, ToolTips,System Controls: Edit, ListBox, ComboBox, 2000 Microsoft Corporation.,FrontPage 10 User Interface,Custom Views,Common Controls: Trees, L
15、ists, StatusBar, ToolTips, ,RichEdit 4.0: RichEd20W, ListBox, ComboBox,MFC,CEditW, CListBoxW, CComboBoxW,CEdit, CListBox, CComboBox,CTreeCtrl, CListCtrl, ,CTreeCtrlW, CListCtrlW, ,MSO, 2000 Microsoft Corporation.,Unicode and ANSI Windows and Messages,How does a mixed Unicode and ANSI environment wor
16、k on Windows NT/2000? What is a Unicode or ANSI window? How do we make a Unicode or ANSI window? What behavior changes between a Unicode and ANSI window? What if a window is subclassed?, 2000 Microsoft Corporation.,Whats a Unicode or ANSI window?,Windows NT/2000 implements the interoperation of ANSI
17、 and Unicode windows Each window has a window procedure (WNDPROC) that the OS invokes when the window receives a message The OS remembers if each WNDPROC handles Unicode or ANSI messages A window with a WNDPROC that handles Unicode is a “Unicode window” and IsUnicodeWindow() will return TRUE. If its
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- CASESTUDYPORTINGANMFCAPPLICATIONTOUNICODEPPT

链接地址:http://www.mydoc123.com/p-379357.html