SlideShare uma empresa Scribd logo
1 de 35
Windows Programming
Prepared for: All Students to study a
big syllabus in simplistic way.
Windows Fundamentals
• Windows applications can be developed using
a procedure-oriented approach in either C or
C++.
• All approaches bring together point-and-shoot
control, pop-up menus, and the ability to run
applications written especially for the
Windows environment.
• Windows gives the ability to develop graphics
user interface(GUI)
The Windows Environment
• Windows is a graphics-based multitasking operating
system.
• Programs developed for this environment have a consistent
look and command structure.
• To the user, this makes learning each successive Windows
application easier.
• To help in the development of Windows applications,
Windows provides numerous built-in functions that allow
for easy implementation of pop-up menus, scroll bars,
dialog boxes, icons that represent a user-friendly interface.
• Windows permits the application to work in a hardwareindependent manner.
Windows Advantages
• Graphics User Interface (GUI)
 All versions of Windows are based on the same
standardized interface.
 This interface uses pictures, or icons, to represent disk
drives, files, subdirectories, and many of the operating
system commands and actions.
• Multitasking Environment
 The Windows multitasking environment allows the user to
have several applications, or several instances of the same
application, running at the same time.
 Each application occupies a rectangular window on the
screen.
Windows Advantages(contd.)
• Advantages of Using a Queued Input
 Windows receives all input from the keyboard, mouse, and
timer in the system queue.
 It is the queue’s responsibility to redirect the input to the
appropriate program since more than one application can
be running.
 It is achieved by copying the message from the system
queue into the application’s queue.
 When application is ready to process the input, it reads
from its queue and dispatches a message to the correct
window.
 Input is accessed with the use of a uniform format called an
input message.
Windows Advantages(contd.)
• OOPs and Windows Messages
 Windows has always employed a pseudo-OOP environment.
 Message is a notification that some event of interest has occurred
that may or may not need a specific action.
 User may initiate these events by clicking or moving the mouse,
changing the size of a window, or making a menu selection.
 The events can also be initiated by the application itself e.g. a
graphics-based spreadsheet could finish a recalculation that results
in the need to update a graphics bar chart.
 It is the message system that allows Windows to achieve its
multitasking capabilities.
 The message system makes it possible for Windows to share the
processor among different applications.
Windows Advantages(contd.)
• Managing Memory
 Most important shared resources under
Windows is system memory.
 As new programs are started and old ones are
terminated, memory become fragmented.
 Windows is capable of consolidating free
memory space by moving blocks of code and
data in memory.
Windows Advantages(contd.)
• Hardware-independence
 Windows frees developer from having to build programs
that take into consideration every possible monitor,
printer, and input device available for computers.
 To achieve it, a device driver for each hardware device is
written once.
 It can be supplied by Microsoft (as it includes a large variety
of hardware drivers with Windows), the application
vendor, or the user.
 Now, the application instructs Windows to draw a filled
rectangle, for example, and Windows worries about how to
accomplish it on the installed hardware.
Windows Advantages(contd.)
• Dynamic Link Libraries (DLL)
 Supports much of Windows’ functionality.
 Enhance the base operating system by
providing a powerful GUI.
Layout of a Window
o
o
o
o
o
o
o
o
o
o
o

Border
Title Bar
Control Icon
System Menu
Minimize Icon
Maximize Icon
Close Window Icon
Vertical Scroll Bar, if desired.
Horizontal Scroll Bar, if desired.
Menu Bar(optional)
Client Area
Windows Graphics Objects














They are collection of data that can be manipulated as a whole and is presented to
the user as part of the visual interface.
Menus
Title bars
Control boxes
Scroll bars
Icons
Cursors
Carets
Message Boxes
Windows Dialog Boxes
Fonts
Bitmaps
Pens
Brushes
How Windows’ Applications Handled?
 Windows provides an application program with access
to hundreds of function calls, directly or indirectly,
through foundation classes.
 These function calls are handled by several main
moduleso KERNEL- responsible for memory management, ,
loading and running an application, and scheduling.
o GDI (graphics device interface)- contains all of the
routines to create and display graphics
o USER modules- takes care of all other application
requirements.
The Windows Message Format
• Messages are used to notify a program that an
event of interest has occurred.
• Only one message system exists under Windows
—the system message queue.
• Each program currently running under Windows
also has its own program message queue.
• The USER module must transfer each message in
the system message queue to a program’s
message queue.
• The program’s message queue stores all
messages for all windows in that program.
Frequently Used Win32 Data Types
CALLBACK
HANDLE
HDC
HWND
LONG
LPARAM
LPCSTR
LPSTR
LPVOID
LRESULT
UINT
WCHAR
WINAPI
WPARAM
HINSTANCE

Replaces FAR PASCAL in application’s call back routine.
32-bit unsigned integer that is used as a handle.
Handle to a device context.
32-bit unsigned integer that is used as the handle to a window.
32-bit signed integer
Type used for declaration of lParam.
LPCSTR is the same as LPSTR, but is used for read-only
string pointers.
32-bit pointer.
A generic pointer type. It is equivalent to (void *).
Used for the return value of a window procedure.
An unsigned integer type
A 16-bit UNICODE character. WCHAR is used to represent all of
the symbols for all of the world’s languages.
Replaces FAR PASCAL in API declarations.
Used for the declaration of wParam.
Handle to the current instance
Frequently Used Win32 Structures
MSG
PAINTSTRUCT
RECT
WNDCLASS

Defines the fields of an input message
Defines the paint structure used when
drawing inside a window
Defines a rectangle
Defines a window class
Handles


•
•
•
•
•
•
•
•
•

Used when writing procedure-oriented Windows applications.
Handle is a unique number that identifies objects likeWindows
Controls
Menus
Icons
Pens
Brushes
Memory allocation
Output devices
Window instances-Each copy of a program loaded in main memory
is called an instance.
Instance Handles
• Windows allows to run more than one copy of
the same application at the same time, so
operating system needs to keep track of each
of these instances.
• It does this by attaching a unique instance
handle to each running copy of the
application.
Calling Convention for Functions
• The parameters for the function are pushed from the
rightmost parameter to the leftmost parameter, in a
normal C and C++ fashion.
• Function declarations under 16-bit Windows 3.x
included the PASCAL modifier, which was more
efficient under DOS in which parameters are pushed
onto the stack from left to right.
• Windows does not use this modifier for 32-bit
applications and instead of it uses _stdcall.
• PASCAL’s use in 32-bit windows application will not
give error, just only warning that _stdcall is not used
Windows Header File: WINDOWS.H
• Provides a path to over a thousand constant
declarations, typedef declarations, and hundreds
of function prototypes
• Main reasons a Windows application takes longer
to compile than a non-Windows C or C++
program is the size of this and associated header
files.
• Traditionally, WINDOWS.H is a required include
file in all C and C++ Windows applications.
• When using the MFC, the WINDOWS.H header
file is included via the AFXWIN.H header file.
Windows Application Components
Windows applications contain two common
and essential elements1.WinMain( ) function
2.Window function.
WinMain( ) Function
 WinMain( ) serves as the entry point for the
Windows application
 Acts in a way similar to the main( ) function in
standard C or C++ programs.
 Responsible for the following:
 Creating and initiating application’s message
processing loop
 Performing any required initializations
 Registering the application’s window class
 Terminating the program
WinMain() (contd.)



Four parameters are passed to the WinMain( ) function from Windows.
WinMain function is defined asint _stdcall WinMain(HINSTANCE hInstance , HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int
nCmdShow)

hInstance
contains the instance handle of the application. This number uniquely identifies the
program when it is running under Windows.
hPrevInstance will always contain a NULL indicating that there is no previous instance of this
application.
MS-DOS versions of Windows (Windows 3.3 and earlier) used hPrevInstance to indicate
whether there were any previous copies of the program loaded. Under operating systems, such as
Windows 95, 98, and NT, each application runs in its own separate address space. For this reason,
under Windows 95, 98, and NT, it returns just NULL.
lpszCmdLine is a long pointer to a null-terminated string that represents the application’s commandline arguments. Normally, lpszCmdLine contains a NULL if the application was started using the
Windows Run command.
nCmdShow defines the possible ways a window can be displayed, such as SW_SHOWNORMAL,
SW_SHOWMAXIMIZED, or SW_MINIMIZED.
WNDCLASS
• Window class serves as a template to defines
attributes of combination of user-selected styles,
fonts, caption bars, icons, size, and so on.
• WinMain( ) function registers the application’s
main window class.
• Same standard C and C++ structure type is used
for all Windows class definitions.
• Predefined window classes are available, but
most programmers define their own window
class.
An example WNDCLASS
•
•

Following example is taken directly from WINUSER.H, which is an #include file
referenced in WINDOWS.H.
The header file contains a typedef statement defining the structure type
WNDCLASSW (a UNICODE-compatible definition), from which WNDCLASS is
derived:
typedef struct tagWNDCLASSW {
UINT
style;
//
WNDPROC lpfnWndProc;
int
cbClsExtra;
int
cbWndExtra;
HANDLE hInstance;
HICON
hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCWSTR lpszMenuName;
LPCWSTR lpszClassName;
} WNDCLASSW, *PWNDCLASSW, NEAR *NPWNDCLASSW, FAR *LPWNDCLASSW;
Fields of WNDCLASS
• Style
The style field names the class style. The styles can be
combined with the bitwise OR operator.
Frequently Used Windows Styles
CS_HREDRAW
CS_VREDRAW
CS_GLOBALCLASS
CS_NOCLOSE
CS_SAVEBITS
CS_CLASSDC
CS_SAVEBITS

Redraws the window when horizontal size changes.
Redraws the window when the vertical size changes
States that the window class is an application
Inhibits the close option from the system menu
Saves that part of a screen that is covered by
another window
Provides the window class a display context

Saves that part of a screen that is covered by another
window
Fields of WNDCLASS (contd)
lpfnWndProc
• Receives a pointer to the window function that will carry out all of the tasks for the
window.
cbClsExtra
• Gives the number of bytes that must be allocated after the window class
structure. It can be set to NULL.
cbWndExtra
• Gives the number of bytes that must be allocated after the window instance. It
can be set to NULL
hInstance
• Defines the instance handle of the application registering the window class. This
cannot be set to NULL.
hIcon
• Icon to be used when the window is minimized. This can be set to NULL.
hCursor
• the cursor to be used with the application. This handle can be set to NULL. The
cursor is valid only within the application’s client area.
Fields of WNDCLASS (contd)
hbrBackground
• Identification for the background brush. This can be a handle to the
physical brush or it can be a color value. Color values must be
standard colors such asCOLOR_ACTIVEBORDER
COLOR_ACTIVECAPTION
COLOR_WINDOW
COLOR_WINDOWFRAME
COLOR_WINDOWTEXT
COLOR_MENU
COLOR_MENUTEXT
COLOR_SCROLLBAR
• If hbrBackground is set to NULL, the application paints its own
background.
Fields of WNDCLASS (contd)
lpszMenuName
• Pointer to a null-terminated character string.
• The string is the resource name of the menu.
• This item can be set to NULL.
lpszClassName
• Pointer to a null-terminated character string.
• The string is the name of the window class.
Defining a Window Class
• Applications can define WNDCLASS by filling the structure’s fields
with the information about the window class.
WNDCLASS wndclass;
wndclass.lpszClassName=szProgName;
wndclass.hInstance =hInstance;
wndclass.lpfnWndProc =WndProc;
wndclass.hCursor =LoadCursor(NULL,IDC_ARROW);
wndclass.hIcon
=NULL;
wndclass.lpszMenuName =szApplName;
wndclass.hbrBackground=GetStockObject(WHITE_BRUSH);
wndclass.style
=CS_HREDRAW|CS_VREDRAW;
wndclass.cbClsExtra =0;
wndclass.cbWndExtra =0;
if (!RegisterClass (&wndclass))
return 0;
Creating a Window
•
•
•
•









Window class defines the general characteristics of a window, allowing
the same window class to be used for many different windows.
While the parameters for CreateWindow( ) specify more detailed
information about the window.
Returns the handle of the newly created window. Otherwise, the function
returns a NULL value.
Parameter information falls under the following categories:
the class,
title,
style,
screen position,
window’s parent handle,
menu handle,
instance handle,
32 bits of additional information
Showing and Updating a Window
• actually display a window
ShowWindow(hWnd,nCmdShow);
• Handle of the window created by the call to
CreateWindow( ) is held in the hWnd parameter.
• Second parameter determines how the window
is initially displayed.
SW_SHOWNORMAL
SW_SHOWMAXIMIZED
SW_SHOWMINIMIZED
SW_SHOWMINNOACTIVE
The Message Loop
while (GetMessage(&msg,NULL,NULL,NULL))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
GetMessage( ) Function
• Copies the message into the message structure
pointed to by long pointer, msg, and sends the
message structure to the main body of the
program.
First NULL parameter instructs the function to
retrieve any of the messages for any window that
belongs to the application.
The last two parameters, tell GetMessage( ) not
to apply any message filters. Message filters can
restrict retrieved messages to specific categories
such as keystrokes or mouse moves only.
The TranslateMessage( ) Function
• As long as this function is included in the message loop, the
keyboard interface will be in effect.
• TranslateMessage( ) function creates an ASCII character
message (WM_CHAR) from a WM_KEYDOWN and
WM_KEYUP message.
• In this way, virtual-key messages can be converted into
character messages with the TranslateMessage( ) function.
• Required only by applications that need to process
character input from the keyboard.
• This ability can be very useful because it allows the user to
make menu selections without having to use the mouse.
The DispatchMessage( ) Function
• Windows sends current messages to
the correct window procedures with the
DispatchMessage( ) function.

Mais conteúdo relacionado

Mais procurados

Visual programming lecture
Visual programming lecture Visual programming lecture
Visual programming lecture AqsaHayat3
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.netJaya Kumari
 
introduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxintroduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxclassall
 
Windows V/S Linux OS - Comparison
Windows V/S Linux OS - ComparisonWindows V/S Linux OS - Comparison
Windows V/S Linux OS - ComparisonHariharan Ganesan
 
Event Driven programming(ch1 and ch2).pdf
Event Driven programming(ch1 and ch2).pdfEvent Driven programming(ch1 and ch2).pdf
Event Driven programming(ch1 and ch2).pdfAliEndris3
 
Visula C# Programming Lecture 1
Visula C# Programming Lecture 1Visula C# Programming Lecture 1
Visula C# Programming Lecture 1Abou Bakr Ashraf
 
Operating Systems Presentation
Operating Systems Presentation Operating Systems Presentation
Operating Systems Presentation Mayank Thanki
 
Operating Systems & Applications
Operating Systems & ApplicationsOperating Systems & Applications
Operating Systems & ApplicationsMaulen Bale
 
Unix Operating System
Unix Operating SystemUnix Operating System
Unix Operating Systemsubhsikha
 
Linux operating system - Overview
Linux operating system - OverviewLinux operating system - Overview
Linux operating system - OverviewAshita Agrawal
 
Operating system 11 system calls
Operating system 11 system callsOperating system 11 system calls
Operating system 11 system callsVaibhav Khanna
 
Presentation on Visual Studio
Presentation on Visual StudioPresentation on Visual Studio
Presentation on Visual StudioMuhammad Aqeel
 

Mais procurados (20)

Operating Systems
Operating SystemsOperating Systems
Operating Systems
 
4.C#
4.C#4.C#
4.C#
 
Visual programming lecture
Visual programming lecture Visual programming lecture
Visual programming lecture
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.net
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
introduction to visual basic PPT.pptx
introduction to visual basic PPT.pptxintroduction to visual basic PPT.pptx
introduction to visual basic PPT.pptx
 
Windows V/S Linux OS - Comparison
Windows V/S Linux OS - ComparisonWindows V/S Linux OS - Comparison
Windows V/S Linux OS - Comparison
 
Event Driven programming(ch1 and ch2).pdf
Event Driven programming(ch1 and ch2).pdfEvent Driven programming(ch1 and ch2).pdf
Event Driven programming(ch1 and ch2).pdf
 
Unix - Filters/Editors
Unix - Filters/EditorsUnix - Filters/Editors
Unix - Filters/Editors
 
Visula C# Programming Lecture 1
Visula C# Programming Lecture 1Visula C# Programming Lecture 1
Visula C# Programming Lecture 1
 
Operating Systems Presentation
Operating Systems Presentation Operating Systems Presentation
Operating Systems Presentation
 
Operating Systems & Applications
Operating Systems & ApplicationsOperating Systems & Applications
Operating Systems & Applications
 
Unix Operating System
Unix Operating SystemUnix Operating System
Unix Operating System
 
Linux operating system - Overview
Linux operating system - OverviewLinux operating system - Overview
Linux operating system - Overview
 
Unix ppt
Unix pptUnix ppt
Unix ppt
 
Asp net
Asp netAsp net
Asp net
 
Operating system 11 system calls
Operating system 11 system callsOperating system 11 system calls
Operating system 11 system calls
 
Case study windows
Case study windowsCase study windows
Case study windows
 
Presentation on Visual Studio
Presentation on Visual StudioPresentation on Visual Studio
Presentation on Visual Studio
 
WPF
WPFWPF
WPF
 

Destaque

Windows programming
Windows programmingWindows programming
Windows programmingBapan Maity
 
VC++ Fundamentals
VC++ FundamentalsVC++ Fundamentals
VC++ Fundamentalsranigiyer
 
Window programming
Window programmingWindow programming
Window programmingPooja Rathee
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programmingRoger Argarin
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt onu9
 
Linux architecture
Linux architectureLinux architecture
Linux architecturemcganesh
 
introduction to_mfc
 introduction to_mfc introduction to_mfc
introduction to_mfctuttukuttu
 
Visual Basic Codes And Screen Designs
Visual Basic Codes And Screen DesignsVisual Basic Codes And Screen Designs
Visual Basic Codes And Screen Designsprcastano
 
LED Lighting Presentation
LED Lighting PresentationLED Lighting Presentation
LED Lighting Presentationrobcohen
 
SlideShare API ''Get Slideshow Information'' method example with Groovy
SlideShare API ''Get Slideshow Information'' method example with GroovySlideShare API ''Get Slideshow Information'' method example with Groovy
SlideShare API ''Get Slideshow Information'' method example with GroovyKeiji Yamashita
 
W pwith cinhindi
W pwith cinhindiW pwith cinhindi
W pwith cinhindiChand Rook
 
Multi-touch Interface for Controlling Multiple Mobile Robots
Multi-touch Interface for Controlling Multiple Mobile RobotsMulti-touch Interface for Controlling Multiple Mobile Robots
Multi-touch Interface for Controlling Multiple Mobile RobotsJun Kato
 

Destaque (20)

Windows programming
Windows programmingWindows programming
Windows programming
 
VC++ Fundamentals
VC++ FundamentalsVC++ Fundamentals
VC++ Fundamentals
 
Window programming
Window programmingWindow programming
Window programming
 
Programming windows
Programming windowsProgramming windows
Programming windows
 
Window architecture
Window architecture Window architecture
Window architecture
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programming
 
Vc++ 3
Vc++ 3Vc++ 3
Vc++ 3
 
Linux.ppt
Linux.ppt Linux.ppt
Linux.ppt
 
Chapter 14
Chapter 14Chapter 14
Chapter 14
 
Active x control
Active x controlActive x control
Active x control
 
Sdi & mdi
Sdi & mdiSdi & mdi
Sdi & mdi
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
 
introduction to_mfc
 introduction to_mfc introduction to_mfc
introduction to_mfc
 
Windows 8 ppt
Windows 8 pptWindows 8 ppt
Windows 8 ppt
 
Visual Basic Codes And Screen Designs
Visual Basic Codes And Screen DesignsVisual Basic Codes And Screen Designs
Visual Basic Codes And Screen Designs
 
LED Lighting Presentation
LED Lighting PresentationLED Lighting Presentation
LED Lighting Presentation
 
SlideShare API ''Get Slideshow Information'' method example with Groovy
SlideShare API ''Get Slideshow Information'' method example with GroovySlideShare API ''Get Slideshow Information'' method example with Groovy
SlideShare API ''Get Slideshow Information'' method example with Groovy
 
W pwith cinhindi
W pwith cinhindiW pwith cinhindi
W pwith cinhindi
 
Seminar 2 ppt
Seminar 2 pptSeminar 2 ppt
Seminar 2 ppt
 
Multi-touch Interface for Controlling Multiple Mobile Robots
Multi-touch Interface for Controlling Multiple Mobile RobotsMulti-touch Interface for Controlling Multiple Mobile Robots
Multi-touch Interface for Controlling Multiple Mobile Robots
 

Semelhante a Windows programming ppt

2 Win7 For Devs Ux Touch Sensors
2 Win7 For Devs Ux Touch Sensors2 Win7 For Devs Ux Touch Sensors
2 Win7 For Devs Ux Touch Sensorsllangit
 
Building Universal Windows Apps for Smartphones and Tablets with XAML & C#
Building Universal Windows Apps for Smartphones and Tablets with XAML & C#Building Universal Windows Apps for Smartphones and Tablets with XAML & C#
Building Universal Windows Apps for Smartphones and Tablets with XAML & C#Nick Landry
 
Cincom® ObjectStudio® New Native GUI Implementation Preview
Cincom® ObjectStudio® New Native GUI Implementation PreviewCincom® ObjectStudio® New Native GUI Implementation Preview
Cincom® ObjectStudio® New Native GUI Implementation PreviewESUG
 
UI Unlimited
UI UnlimitedUI Unlimited
UI UnlimitedESUG
 
Computer and multimedia Week 1 Windows Architecture.pptx
Computer and multimedia Week 1 Windows Architecture.pptxComputer and multimedia Week 1 Windows Architecture.pptx
Computer and multimedia Week 1 Windows Architecture.pptxfatahozil
 
Features of windows
Features of windowsFeatures of windows
Features of windowsahmreenmalik
 
How to modernise WPF and Windows Forms applications with Windows Apps SDK
How to modernise WPF and Windows Forms applications with Windows Apps SDKHow to modernise WPF and Windows Forms applications with Windows Apps SDK
How to modernise WPF and Windows Forms applications with Windows Apps SDKMirco Vanini
 
Mca i pic u-1 introduction to c language
Mca i pic u-1 introduction to c languageMca i pic u-1 introduction to c language
Mca i pic u-1 introduction to c languageRai University
 
Bsc cs i pic u-1 introduction to c language
Bsc cs i pic u-1 introduction to c languageBsc cs i pic u-1 introduction to c language
Bsc cs i pic u-1 introduction to c languageRai University
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0DivyaR219113
 
introduction to c language
 introduction to c language introduction to c language
introduction to c languageRai University
 
Btech i pic u-1 introduction to c language
Btech i pic u-1 introduction to c languageBtech i pic u-1 introduction to c language
Btech i pic u-1 introduction to c languageRai University
 
Visual programming lab
Visual programming labVisual programming lab
Visual programming labSoumya Behera
 
Introduction.pptx
Introduction.pptxIntroduction.pptx
Introduction.pptxSUDHAKAR S
 
Diploma ii cfpc u-1 introduction to c language
Diploma ii  cfpc u-1 introduction to c languageDiploma ii  cfpc u-1 introduction to c language
Diploma ii cfpc u-1 introduction to c languageRai University
 

Semelhante a Windows programming ppt (20)

2 Win7 For Devs Ux Touch Sensors
2 Win7 For Devs Ux Touch Sensors2 Win7 For Devs Ux Touch Sensors
2 Win7 For Devs Ux Touch Sensors
 
Building Universal Windows Apps for Smartphones and Tablets with XAML & C#
Building Universal Windows Apps for Smartphones and Tablets with XAML & C#Building Universal Windows Apps for Smartphones and Tablets with XAML & C#
Building Universal Windows Apps for Smartphones and Tablets with XAML & C#
 
Operating System PPT
Operating System PPTOperating System PPT
Operating System PPT
 
Cincom® ObjectStudio® New Native GUI Implementation Preview
Cincom® ObjectStudio® New Native GUI Implementation PreviewCincom® ObjectStudio® New Native GUI Implementation Preview
Cincom® ObjectStudio® New Native GUI Implementation Preview
 
UI Unlimited
UI UnlimitedUI Unlimited
UI Unlimited
 
Computer and multimedia Week 1 Windows Architecture.pptx
Computer and multimedia Week 1 Windows Architecture.pptxComputer and multimedia Week 1 Windows Architecture.pptx
Computer and multimedia Week 1 Windows Architecture.pptx
 
Unit 4 software
Unit 4  softwareUnit 4  software
Unit 4 software
 
Features of windows
Features of windowsFeatures of windows
Features of windows
 
How to modernise WPF and Windows Forms applications with Windows Apps SDK
How to modernise WPF and Windows Forms applications with Windows Apps SDKHow to modernise WPF and Windows Forms applications with Windows Apps SDK
How to modernise WPF and Windows Forms applications with Windows Apps SDK
 
Mca i pic u-1 introduction to c language
Mca i pic u-1 introduction to c languageMca i pic u-1 introduction to c language
Mca i pic u-1 introduction to c language
 
Bsc cs i pic u-1 introduction to c language
Bsc cs i pic u-1 introduction to c languageBsc cs i pic u-1 introduction to c language
Bsc cs i pic u-1 introduction to c language
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0
 
introduction to c language
 introduction to c language introduction to c language
introduction to c language
 
Btech i pic u-1 introduction to c language
Btech i pic u-1 introduction to c languageBtech i pic u-1 introduction to c language
Btech i pic u-1 introduction to c language
 
Visual programming lab
Visual programming labVisual programming lab
Visual programming lab
 
Introduction.pptx
Introduction.pptxIntroduction.pptx
Introduction.pptx
 
Diploma ii cfpc u-1 introduction to c language
Diploma ii  cfpc u-1 introduction to c languageDiploma ii  cfpc u-1 introduction to c language
Diploma ii cfpc u-1 introduction to c language
 
Unit 2
Unit 2Unit 2
Unit 2
 
What is software?
What is software?What is software?
What is software?
 
2 software
2 software2 software
2 software
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 

Último (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

Windows programming ppt

  • 1. Windows Programming Prepared for: All Students to study a big syllabus in simplistic way.
  • 2. Windows Fundamentals • Windows applications can be developed using a procedure-oriented approach in either C or C++. • All approaches bring together point-and-shoot control, pop-up menus, and the ability to run applications written especially for the Windows environment. • Windows gives the ability to develop graphics user interface(GUI)
  • 3. The Windows Environment • Windows is a graphics-based multitasking operating system. • Programs developed for this environment have a consistent look and command structure. • To the user, this makes learning each successive Windows application easier. • To help in the development of Windows applications, Windows provides numerous built-in functions that allow for easy implementation of pop-up menus, scroll bars, dialog boxes, icons that represent a user-friendly interface. • Windows permits the application to work in a hardwareindependent manner.
  • 4. Windows Advantages • Graphics User Interface (GUI)  All versions of Windows are based on the same standardized interface.  This interface uses pictures, or icons, to represent disk drives, files, subdirectories, and many of the operating system commands and actions. • Multitasking Environment  The Windows multitasking environment allows the user to have several applications, or several instances of the same application, running at the same time.  Each application occupies a rectangular window on the screen.
  • 5. Windows Advantages(contd.) • Advantages of Using a Queued Input  Windows receives all input from the keyboard, mouse, and timer in the system queue.  It is the queue’s responsibility to redirect the input to the appropriate program since more than one application can be running.  It is achieved by copying the message from the system queue into the application’s queue.  When application is ready to process the input, it reads from its queue and dispatches a message to the correct window.  Input is accessed with the use of a uniform format called an input message.
  • 6. Windows Advantages(contd.) • OOPs and Windows Messages  Windows has always employed a pseudo-OOP environment.  Message is a notification that some event of interest has occurred that may or may not need a specific action.  User may initiate these events by clicking or moving the mouse, changing the size of a window, or making a menu selection.  The events can also be initiated by the application itself e.g. a graphics-based spreadsheet could finish a recalculation that results in the need to update a graphics bar chart.  It is the message system that allows Windows to achieve its multitasking capabilities.  The message system makes it possible for Windows to share the processor among different applications.
  • 7. Windows Advantages(contd.) • Managing Memory  Most important shared resources under Windows is system memory.  As new programs are started and old ones are terminated, memory become fragmented.  Windows is capable of consolidating free memory space by moving blocks of code and data in memory.
  • 8. Windows Advantages(contd.) • Hardware-independence  Windows frees developer from having to build programs that take into consideration every possible monitor, printer, and input device available for computers.  To achieve it, a device driver for each hardware device is written once.  It can be supplied by Microsoft (as it includes a large variety of hardware drivers with Windows), the application vendor, or the user.  Now, the application instructs Windows to draw a filled rectangle, for example, and Windows worries about how to accomplish it on the installed hardware.
  • 9. Windows Advantages(contd.) • Dynamic Link Libraries (DLL)  Supports much of Windows’ functionality.  Enhance the base operating system by providing a powerful GUI.
  • 10. Layout of a Window o o o o o o o o o o o Border Title Bar Control Icon System Menu Minimize Icon Maximize Icon Close Window Icon Vertical Scroll Bar, if desired. Horizontal Scroll Bar, if desired. Menu Bar(optional) Client Area
  • 11. Windows Graphics Objects              They are collection of data that can be manipulated as a whole and is presented to the user as part of the visual interface. Menus Title bars Control boxes Scroll bars Icons Cursors Carets Message Boxes Windows Dialog Boxes Fonts Bitmaps Pens Brushes
  • 12. How Windows’ Applications Handled?  Windows provides an application program with access to hundreds of function calls, directly or indirectly, through foundation classes.  These function calls are handled by several main moduleso KERNEL- responsible for memory management, , loading and running an application, and scheduling. o GDI (graphics device interface)- contains all of the routines to create and display graphics o USER modules- takes care of all other application requirements.
  • 13. The Windows Message Format • Messages are used to notify a program that an event of interest has occurred. • Only one message system exists under Windows —the system message queue. • Each program currently running under Windows also has its own program message queue. • The USER module must transfer each message in the system message queue to a program’s message queue. • The program’s message queue stores all messages for all windows in that program.
  • 14. Frequently Used Win32 Data Types CALLBACK HANDLE HDC HWND LONG LPARAM LPCSTR LPSTR LPVOID LRESULT UINT WCHAR WINAPI WPARAM HINSTANCE Replaces FAR PASCAL in application’s call back routine. 32-bit unsigned integer that is used as a handle. Handle to a device context. 32-bit unsigned integer that is used as the handle to a window. 32-bit signed integer Type used for declaration of lParam. LPCSTR is the same as LPSTR, but is used for read-only string pointers. 32-bit pointer. A generic pointer type. It is equivalent to (void *). Used for the return value of a window procedure. An unsigned integer type A 16-bit UNICODE character. WCHAR is used to represent all of the symbols for all of the world’s languages. Replaces FAR PASCAL in API declarations. Used for the declaration of wParam. Handle to the current instance
  • 15. Frequently Used Win32 Structures MSG PAINTSTRUCT RECT WNDCLASS Defines the fields of an input message Defines the paint structure used when drawing inside a window Defines a rectangle Defines a window class
  • 16. Handles   • • • • • • • • • Used when writing procedure-oriented Windows applications. Handle is a unique number that identifies objects likeWindows Controls Menus Icons Pens Brushes Memory allocation Output devices Window instances-Each copy of a program loaded in main memory is called an instance.
  • 17. Instance Handles • Windows allows to run more than one copy of the same application at the same time, so operating system needs to keep track of each of these instances. • It does this by attaching a unique instance handle to each running copy of the application.
  • 18. Calling Convention for Functions • The parameters for the function are pushed from the rightmost parameter to the leftmost parameter, in a normal C and C++ fashion. • Function declarations under 16-bit Windows 3.x included the PASCAL modifier, which was more efficient under DOS in which parameters are pushed onto the stack from left to right. • Windows does not use this modifier for 32-bit applications and instead of it uses _stdcall. • PASCAL’s use in 32-bit windows application will not give error, just only warning that _stdcall is not used
  • 19. Windows Header File: WINDOWS.H • Provides a path to over a thousand constant declarations, typedef declarations, and hundreds of function prototypes • Main reasons a Windows application takes longer to compile than a non-Windows C or C++ program is the size of this and associated header files. • Traditionally, WINDOWS.H is a required include file in all C and C++ Windows applications. • When using the MFC, the WINDOWS.H header file is included via the AFXWIN.H header file.
  • 20. Windows Application Components Windows applications contain two common and essential elements1.WinMain( ) function 2.Window function.
  • 21. WinMain( ) Function  WinMain( ) serves as the entry point for the Windows application  Acts in a way similar to the main( ) function in standard C or C++ programs.  Responsible for the following:  Creating and initiating application’s message processing loop  Performing any required initializations  Registering the application’s window class  Terminating the program
  • 22. WinMain() (contd.)   Four parameters are passed to the WinMain( ) function from Windows. WinMain function is defined asint _stdcall WinMain(HINSTANCE hInstance , HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) hInstance contains the instance handle of the application. This number uniquely identifies the program when it is running under Windows. hPrevInstance will always contain a NULL indicating that there is no previous instance of this application. MS-DOS versions of Windows (Windows 3.3 and earlier) used hPrevInstance to indicate whether there were any previous copies of the program loaded. Under operating systems, such as Windows 95, 98, and NT, each application runs in its own separate address space. For this reason, under Windows 95, 98, and NT, it returns just NULL. lpszCmdLine is a long pointer to a null-terminated string that represents the application’s commandline arguments. Normally, lpszCmdLine contains a NULL if the application was started using the Windows Run command. nCmdShow defines the possible ways a window can be displayed, such as SW_SHOWNORMAL, SW_SHOWMAXIMIZED, or SW_MINIMIZED.
  • 23. WNDCLASS • Window class serves as a template to defines attributes of combination of user-selected styles, fonts, caption bars, icons, size, and so on. • WinMain( ) function registers the application’s main window class. • Same standard C and C++ structure type is used for all Windows class definitions. • Predefined window classes are available, but most programmers define their own window class.
  • 24. An example WNDCLASS • • Following example is taken directly from WINUSER.H, which is an #include file referenced in WINDOWS.H. The header file contains a typedef statement defining the structure type WNDCLASSW (a UNICODE-compatible definition), from which WNDCLASS is derived: typedef struct tagWNDCLASSW { UINT style; // WNDPROC lpfnWndProc; int cbClsExtra; int cbWndExtra; HANDLE hInstance; HICON hIcon; HCURSOR hCursor; HBRUSH hbrBackground; LPCWSTR lpszMenuName; LPCWSTR lpszClassName; } WNDCLASSW, *PWNDCLASSW, NEAR *NPWNDCLASSW, FAR *LPWNDCLASSW;
  • 25. Fields of WNDCLASS • Style The style field names the class style. The styles can be combined with the bitwise OR operator. Frequently Used Windows Styles CS_HREDRAW CS_VREDRAW CS_GLOBALCLASS CS_NOCLOSE CS_SAVEBITS CS_CLASSDC CS_SAVEBITS Redraws the window when horizontal size changes. Redraws the window when the vertical size changes States that the window class is an application Inhibits the close option from the system menu Saves that part of a screen that is covered by another window Provides the window class a display context Saves that part of a screen that is covered by another window
  • 26. Fields of WNDCLASS (contd) lpfnWndProc • Receives a pointer to the window function that will carry out all of the tasks for the window. cbClsExtra • Gives the number of bytes that must be allocated after the window class structure. It can be set to NULL. cbWndExtra • Gives the number of bytes that must be allocated after the window instance. It can be set to NULL hInstance • Defines the instance handle of the application registering the window class. This cannot be set to NULL. hIcon • Icon to be used when the window is minimized. This can be set to NULL. hCursor • the cursor to be used with the application. This handle can be set to NULL. The cursor is valid only within the application’s client area.
  • 27. Fields of WNDCLASS (contd) hbrBackground • Identification for the background brush. This can be a handle to the physical brush or it can be a color value. Color values must be standard colors such asCOLOR_ACTIVEBORDER COLOR_ACTIVECAPTION COLOR_WINDOW COLOR_WINDOWFRAME COLOR_WINDOWTEXT COLOR_MENU COLOR_MENUTEXT COLOR_SCROLLBAR • If hbrBackground is set to NULL, the application paints its own background.
  • 28. Fields of WNDCLASS (contd) lpszMenuName • Pointer to a null-terminated character string. • The string is the resource name of the menu. • This item can be set to NULL. lpszClassName • Pointer to a null-terminated character string. • The string is the name of the window class.
  • 29. Defining a Window Class • Applications can define WNDCLASS by filling the structure’s fields with the information about the window class. WNDCLASS wndclass; wndclass.lpszClassName=szProgName; wndclass.hInstance =hInstance; wndclass.lpfnWndProc =WndProc; wndclass.hCursor =LoadCursor(NULL,IDC_ARROW); wndclass.hIcon =NULL; wndclass.lpszMenuName =szApplName; wndclass.hbrBackground=GetStockObject(WHITE_BRUSH); wndclass.style =CS_HREDRAW|CS_VREDRAW; wndclass.cbClsExtra =0; wndclass.cbWndExtra =0; if (!RegisterClass (&wndclass)) return 0;
  • 30. Creating a Window • • • •         Window class defines the general characteristics of a window, allowing the same window class to be used for many different windows. While the parameters for CreateWindow( ) specify more detailed information about the window. Returns the handle of the newly created window. Otherwise, the function returns a NULL value. Parameter information falls under the following categories: the class, title, style, screen position, window’s parent handle, menu handle, instance handle, 32 bits of additional information
  • 31. Showing and Updating a Window • actually display a window ShowWindow(hWnd,nCmdShow); • Handle of the window created by the call to CreateWindow( ) is held in the hWnd parameter. • Second parameter determines how the window is initially displayed. SW_SHOWNORMAL SW_SHOWMAXIMIZED SW_SHOWMINIMIZED SW_SHOWMINNOACTIVE
  • 32. The Message Loop while (GetMessage(&msg,NULL,NULL,NULL)) { TranslateMessage(&msg); DispatchMessage(&msg); }
  • 33. GetMessage( ) Function • Copies the message into the message structure pointed to by long pointer, msg, and sends the message structure to the main body of the program. First NULL parameter instructs the function to retrieve any of the messages for any window that belongs to the application. The last two parameters, tell GetMessage( ) not to apply any message filters. Message filters can restrict retrieved messages to specific categories such as keystrokes or mouse moves only.
  • 34. The TranslateMessage( ) Function • As long as this function is included in the message loop, the keyboard interface will be in effect. • TranslateMessage( ) function creates an ASCII character message (WM_CHAR) from a WM_KEYDOWN and WM_KEYUP message. • In this way, virtual-key messages can be converted into character messages with the TranslateMessage( ) function. • Required only by applications that need to process character input from the keyboard. • This ability can be very useful because it allows the user to make menu selections without having to use the mouse.
  • 35. The DispatchMessage( ) Function • Windows sends current messages to the correct window procedures with the DispatchMessage( ) function.