INTRODUCTION TO VISUAL
PROGRAMMING
K.Muneeswaran
Windows Programming Vs Visual
Programming
VP - deals with GUI front end and its programming
WP – deals with connecting windows (front end) with
applications (backend) and its programming
WINDOW – Win 32 Application
is a rectangular area of the screen where the application displays
output and receives input from the user.
The first task of the application is to create a window.
Shares the screen with other windows, including those from
other applications.
Only one window at a time can receive input from the user.
The user can use the
Mouse
Keyboard
other input device
to interact with this window and the application that owns it.
VC++ has two modes of operations
Text based (conventional programming - main)
GUI based (Programs linked with windows and GUI
controls - WinMain)
WinMain – Application Entry and Parameters
Handle to current Instance
Handle to previous instance (multiple instance of the
applications are supported)
Command Line Arguments
Style of window
MS - Visual Programming
Software Development Kit (SDK)
A set of tools and libraries for creating software
applications for Windows operating systems
MFC
The Microsoft Foundation Class Library is an
"application framework" for programming in Microsoft
Windows
Application Wizard
Generates a new, fully functional application from which
one can build a more complex application
SDK
Makes use of the windows API written in C language
Every time window attributes have to be specified and
registered
MFC
MS provides a rich set of classes of window objects and
controls specifying their attributes
C++ based
Made up of ready made classes
Both applications and windows are class based
CWinApp
The base class from which you derive a
Windows application object
CWnd
Provides the base functionality of all window
classes in the Microsoft Foundation Class
Library.
Application Wizard
Ease the developer’s work
Developer needs to know the structure of VC++
Template header and C++ files are automatically created
Class Hierarchy
CObject
CCmdTarget
CWnd
CException
CFile
CDC
CArray
Derivation of CDialogBar
Derivation of CDialog
Device context
is a structure that defines
a set of graphic objects
their associated attributes
and the graphic modes that affect output.
The graphic objects include
a pen for line drawing
a brush for painting and filling,
a bitmap for copying or scrolling parts of the screen
a palette for defining the set of available colors
a region for clipping and other operations
and a path for painting and drawing operations
Messages and Window procedure
Input
Keyboard events
Mouse events
Output
GDI and devices
Bitmap
DirectX
Window Controls
Accelerator
Bitmap
Cursor
Dialog
HTML
Icon
Menu
String Table
Tool bar
Dialog and associated controls
Label
Edit Box
Push button
Text Box
Scroll bar (vertical, horizontal)
Drop down list etc
Document - View architecture
Document : 13112006
View : 13-11-2006
13/11/2006
11/13/2006
11:13:2006 …
Frame and windows
Containers
Multiple windows
Threads
MFC class hierarchy
Objects to Components
Specification based
Interface is common
Implementation is different
COM, OLE
DCOM (ACTIVEX controls - OCX)
DCOM architecture
ActiveX Controls
formerly known as OLE controls or OCX controls,
are components (or objects)
can be inserted into a Web page or other application
to reuse packaged functionality someone else programmed.
Also be used in applications written in many programming
languages (including all MS programming and database
languages)
Hundreds of ActiveX controls
simple timer control
Sophisticated control like
word processor
Spread sheet
ActiveX Controls … Contd
Based on Distributed COM
DCOM – Distributed Component Object Model
Scalable
Feature two way communication with the containers
4 ways to write an ActiveX control
MFC
ActiveX Template Library (ATL)
BaseCtrl framework
Visual J++ (COM objects only)
Additional support by VC++
Support for
data base connectivity
Networking (WinSock)
TAPI
Multimedia
Client/Server
HTTP
and what not
Support for Database connectivity (ODBC,DAO)
THANK YOU