Introduction to Windows Programming with Microsoft Framework Classes (MFC) Jim Fawcett Summer 2004 Syracuse University
References Developing Professional Applications for Windows 95 and NT Using MFC, Marshall Brain and Lance Lovett, Prentice Hall, 1997. Now out of print. My copy is in the Science and Technology Library in Carnegie, next to Bowne Hall. Practical Visual C++ 6, Jon Bates and Tim Tompkins, Que, 1999. Currently available through Barnes & Noble, Borders, and Amazon.com. My copy is being held for you in the Science and Technology Library. Programming Windows with MFC, Jeff Prosise, Microsoft Press, 1999. This is a large, effective book, used in CSE 791 – Advanced Windows Programming, but overkill for this course. Syracuse University
Syracuse University
The Simplest Classical Windows Program Output from the MINWIN program is shown on the next slide. The program: Creates a frame window Paints a fixed text message in the window Reacts to left mouse button clicks by creating a MessageBox You will the program code, minwin.cpp, and project workspace, in folder: CoreTechnologies\WindowsProgramming\code\basicWindows Syracuse University
Syracuse University
Syracuse University
Syracuse University
The Simplest MFC based Program Output from the MFCWIN program is shown on the next slide. The program: Creates a frame window Paints a fixed text message in the window Reacts to left mouse button clicks by creating a MessageBox You will the program code, mfcwin.cpp, and project workspace, mfcwin.dsw in the folder MFCWIN in. CoreTechnologies\WindowsProgramming\code\basicWindows Syracuse University
Syracuse University
Dialog Based Applications A dialog is an opaque window, called a form, on which are embedded a collection of smaller windows called controls. The main dialog form is wrapped in a dialog class, derived from MFC’s CDialog class. Each control is a window with a self contained set of functionality that dialog designers use “as-is”, or modify in limited ways. Controls are placed on the dialog form by dragging from a palette in the dialog resource editor. Controls are hooked into the application processing by providing message handlers in the main dialog class that access the controls using CDialog::GetDlgItem(…) and CDialog::SetDlgItem(…) member functions. Syracuse University
Syracuse University
Structure of MFC Dialog based Application Syracuse University
Frame Window Applications A frame window application consists of a window that supports a large client area in which text and graphics are displayed, embedded in a frame that supports menus and perhaps some controls. All text and drawing in the client area are supported by the Graphics Device Interface Object (CGDIObject) and Device Context (CDC) classes. Most frame window applications use the Single Document Interface (SDI) or Multiple Document Interface (MDI) architectures. These follow document/view architecture structure: Documents provide all the support for managing the program’s data, including reading and writing from persistent storage. Views provide all the support for displaying one or more views of the data and most user interactions with the program. Syracuse University
Syracuse University
Syracuse University
Syracuse University
End of Presentation Syracuse University