MFC Workshop: Intro to MFC. What is MFC? Microsoft Foundation Classes C++ wrappers to the Windows SDK An application framework A useful set of extensions.

Slides:



Advertisements
Similar presentations
Native Device Development in Visual Studio Whidbey Nishan Jebanasam Program Manager Microsoft Corporation Rich Hanbidge Developer Microsoft Corporation.
Advertisements

MFC Workshop: Intro to the Document/View Architecture.
Intro to Windows Programming Basic Ideas. Program Entry Point Int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
Introduction to Microsoft Windows MFC Programming: the Application/Window Approach Lecture 4.
ASP.NET Programming with C# and SQL Server First Edition
A First Program Using C#
9/3/2015Department of IT1 The Microsoft Foundation Class Library Application Framework.
Programming Languages and Paradigms Object-Oriented Programming.
M1G Introduction to Programming 2 4. Enhancing a class:Room.
C++ C++ Overview (I) What is Object Orientated Programming? Approach: Break problem into subgroups of related parts that take into account code and data;
INTRODUCTION TO VC++ As the Microsoft Windows 3.X and then 5.5 operating system was becoming popular, many programmers were interested in creating graphical.
Overview of Previous Lesson(s) Over View  OOP  A class is a data type that you define to suit customized application requirements.  A class can be.
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
CS360/CS580H GUI & Windows Programming. Outline Win32/Windows API & SDK Visual Studio MFC – Microsoft Foundation Classes C# &.NET – concepts Windows Forms.
Windows CE 시스템 개발 개요. 임베디드시스템소프트웨어 -Windows CE 2 Overview  Selecting a Windows Embedded Operating System  The Windows CE Platform Development Cycle.
Bertrand Bellenot ROOT Users Workshop Mar ROOT GUI Builder Status & Plans ROOT & External GUI World MFC, FOX, Qt, PVSS… Snapshot of the Future.
Building an MFC Application Using the Wizard. Terms Solution – A container for related projects – An executable or DLL – May be constructed from multiple.
Visual C++ Lecture 11 Friday, 29 Aug Windows Graphic User Interface l Event driven programming environment l Windows graphic libraries (X11 on Unix,
CS360/CS580H GUI & Windows Programming Introduction.
BZUPAGES.COM Visual Programming Lecture – 5 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.
Getting Started The structure of a simple wxWidgets program, Look at where and how a wxWidgets application starts and ends, how to show the main window,
Overview of Previous Lesson(s) Over View  Visual C++ provides us with 3 basic ways of creating an interactive Windows application  Using the Windows.
Chapter 1: Hello, MFC Windows Programming Model Department of Digital Contents Sang Il Park.
Chapter 1: Hello, MFC Your first MFC Application Department of Digital Contents Sang Il Park.
MFC Windows Programming: Document/View Approach More detailed notes at: 360/notes-html/class15.htm.
Chapter 6 Object-Oriented Java Script JavaScript, Third Edition.
Overview of Previous Lesson(s) Over View  Microsoft Foundation Classes (MFC)  A set of predefined classes upon which Windows programming with Visual.
Microsoft Foundation Classes. What is MFC? Set of C++ classes written by MS Simplifies writing complex programs Covers many areas: – GUI – I/O – O/S interfaces.
BZUPAGES.COM Visual Programming Lecture – 6- 7 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.
GAM666 – Introduction To Game Programming You must use special libraries (aka APIs – application programming interfaces) to make something other than a.
Windows CE 시스템 개발 개요. 모바일운영체제 - Windows CE 2 Overview  Selecting a Windows Embedded Operating System  The Windows CE Platform Development Cycle  The.
Microsoft Foundation Classes
Object Oriented Software Development
Presentation Outline Introduction Painting and Repainting GDI.
CITA 342 Section 2 Visual Programming. Allows the use of visual expressions (such as graphics, drawings, or animation) in the process of programming.
Chapter2: Drawing a Window. Review: Introducing MFC.
Lecture 10 Concepts of Programming Languages Arne Kutzner Hanyang University / Seoul Korea.
Chapter2: Drawing a Window
Copyright © 2005 Elsevier Object-Oriented Programming Control or PROCESS abstraction is a very old idea (subroutines!), though few languages provide it.
Rachana George.NET Security, Summer Introduction Sample Unmanaged C++ Library Retrieve Exported Information from the DLL Perform Platform Invoke.
Overview of Previous Lesson(s) Over View 3 Program.
Object Oriented Programming Elhanan Borenstein Lecture #7.
Chapter 6: FILE I/O and Serialize CFile class. FILE I/O Serialization and the CArchive Class.
Overview of Previous Lesson(s) Over View  Windows Programming  WinMain()  Where execution of the program begins and basic program initialization is.
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
1 C++ Classes & Object Oriented Programming Overview & Terminology.
Introduction to MFC Microsoft Foundation Classes.
Threads and Thread Synchronization. Introduction In windows the basic unit of execution is the thread. It is the smallest schedulable unit of execution.
Windows App Studio Windows App Studio is the tool that makes it fast and easy to build Windows 10 apps. It’s accessible from any device with a browser.
Visual Info Processing Programming Guide
Building an MFC Application
Chapter 14 Windows Programming with the Microsoft Foundation Classes
Introduction to Windows Programming
Document/View Architecture
Message Handling in MFC
Windows Programming Environments
Microsoft Foundation Classes MFC
Steps to Build Frame Window Recipe Application
Classes and Inheritance
Chapter 1 Hello, MFC.
Windows Programming Model
CS212: Object Oriented Analysis and Design
Introduction to Windows Programming with Microsoft Framework Classes (MFC) Jim Fawcett Summer 2004 Syracuse University.
Object Oriented Analysis and Design
Queued and Nonqueued Messages
Windows Controls & Concepts
MFC Document/View programs
NAME 436.
Lecture 10 Concepts of Programming Languages
Overview of System Development for Windows CE.NET
Presentation transcript:

MFC Workshop: Intro to MFC

What is MFC? Microsoft Foundation Classes C++ wrappers to the Windows SDK An application framework A useful set of extensions

Why MFC? Eliminates a lot of the monotony of Windows programming. Written in C++ –Code reuse saves time –Relatively easy for C++ programmers to pick up –Most Windows objects act like C++ objects in MFC –Small amount of overhead for a class library You can still access the SDK. Cross-platform (sort of)

How to use MFC Derive the from classes to add functionality. Override base class members. Add new members. Some classes can be used directly.

The one and only CWinApp Derived from CObject->CCmdTarget- >CWinThread. –CObject: serialization and runtime information –CCmdTarget: allows message handling –CWinThread: allow multithreading, the CWinApp object is the primary thread Derive one class, and declare one instance per application. Encompasses WinMain(), message pump, etc.

CWnd and CFrameWnd Holds an HWND and all of the functions associated with it. Hides the WndProc() and handles message routing. CWnd is the base class for everything from CButton to CFrameWnd. CFrameWnd is the class used as the main window in most applications.

Message Handling In MFC the message pump and WndProc are hidden by a set of macros. MFC messaging acts virtually without the overhead. To add message routing put the following line in the class declaration, DECLARE_MESSAGE_MAP(). For every message you want to handle you have to add an entry to the message map.

CDC and CPaintDC MFC device context classes. Holds a device context handle, and wraps the SDK DC functions. CPaintDC is used when responding to WM_PAINT messages. CPaintDC encapsulates calls to BeginPaint and EndPaint in the constructor and destructor respectively.

Simple types and GDI classes MFC does a very simple encapsulation of structures like RECT and POINT with classes like CRect and CPoint. One of the most useful classes in MFC is CString. –Similar to a character array, with a handful of useful methods All of the GDI structures have their own classes –creation and destruction is handled by C++ –can be used freely with the old structures

MFC References Programming Windows With MFC –Jeff Prosise Professional MFC with Visual C++ –Mike Blaszczak MFC Internals –George Shepherd and Scot Wingo news: microsoft.public.vc.mfc MSDN Library The code itself, \VC98\Mfc\Src