You are on page 1of 6

SUBJECT : VISUAL PROGRAMMING

SEMESTER / DEPT : V IT

UNIT - I

WINDOWS PROGRAMMING

1. What are the advantages of using Windows ?

 Graphics User Interface


 Multitasking
 Memory Management
 Dynamic Link Library

2.What is Multitasking ?

The Multitasking environment allows the user to have several applications ,


or several instances of the same application , running at the same time . An Active
application is the one that is receiving the user’s attention.

3. Short notes on GUI ?

The most important Windows feature is the standardized graphical user


interface ,Which is also the most important for the user.

 The Consistent interface uses pictures , or icons , to represent


disk drives , files , subdirectories and many of the operating system
commands and actions.
 A Look and Feel are common to all Windows applications.

4. What is the Window ?

A rectangular portion of the display device is called as Windows.


The elements are Border, Client area , Title Bar etc.

5.What is the Window Message ?

The Window Message is coming through Windows Environment. In Windows,


the Messages are used to process some specific actions. Some of the Window
Messages are ,

 WM_PAINT
 WM_COMMAND
 WM_DESTROY
 WM_CREATE
6.What is the Use of WM_PAINT Message ?

The Paint Message prepares the application’s client area for updating and
obtains a display context for the Window.It repaints the client area.It is invoked
by the following conditions.
 When resizing a Window
 When the portion of a client area as been hidden by a menu or
Dialog box that just been closed.
 When using the ScrollWindow( ) function.
 When forcing a WM_PAINT message with a call to the
InvalidateRect( ) Or InvalidateRgn( ) function.

7.What is the use of CreateWindow Function ?

A Window is created with a call to the CreateWindow Function.This process


is common for all the versions of windows.

SYNTAX :
CreateWindow(class name,window name, window style , x position , y position,
Width,height , Window handle , Menu handle, Instance handle , 32 bits
information )

8. What is the Message Loop ?

The Basic Components of the Windows Program is called Message Loop.


The application needs a message processing loop once the call to WinMain( ) has
created and displayed the Window.The Following set of statements are called
as Windows Message Loop statements.

While ( GetMessage (&lpMsg,NULL,0,0))


{
TranslateMessage(&lpMsg);
DispatchMessage(&lpMsg);
}

9.How do you display the Window ?


The Two functions are used to display the created Window .
• ShowWindow ( ) :
It is needed to actually display a Window.
SYNTAX : ShowWindow(Window handle , Display Mode )

•UpdateWindow( ) :
The final step in displaying a window requires a call to UpdateWindow ( )
Function.
10. What is the use of WM_DESTROY Message ?

When the close option is selected by the user from an application’s system
menu, the WM_DESTROY Message is invoked.It is used to stop the application.
The PostQuitMessage( ) function is used to terminate the operations.

11.What are the responsible of WinMain( ) function ?

The WinMain ( ) function is responsible for ,

 Registering the Window Class.


 Performing any required initializations.
 Creating & initiating the Message Loop.
 Terminating the program by WM_QUIT Message.

12. What is the use of Device Context ?

The graphics and text commands send to the Device context are always
the same , regardless of whether the physical output is showing up on a VGA
screen,IBM 8514 video device , printer etc.

13. What is the Graphics Device Interface (GDI ) ?

The Part of the Windows that converts the Windows graphic function calls
to the actual commands sent to the hardware is the Graphics Device Interface
(GDI ) .
The GDI is a program file called GDI.EXE that is stored in the Windows
System Directory.The Windows environment will load GDI.EXE into memory when
it is needed for graphical output.

14. What are the parts of Windows Programming ?

1.WinMain( )
2.WndProc( )

The WinMain( ) has the window class properties.


The WndProc has a Program Logic.

15.Short notes on ScrollBar ?


The Scroll bars are used to scroll the image in the window’s client area.
These controls are child Window controls and they are typically used to allow the user
to enter an integer value by moving the scroll bar thumb.
Some of the window Scroll messages are ,
1.WM_HSCROLL
2. WM_VSCROLL

16. List Some of the Scroll Bar Functions ?

 GetScrollPos( ) - Retrieve the Current position.


 GetScrollRange( )-Retrieve the Minimum and Maximum values.
 SetScrollPos( ) -Set the Position of the Scroll bar thumb.
 SetScrollRange( )- Set the Minimum and Maximum values.
 ShowScrollBar - Display the Scroll Bar.

17.What is the use of WM_MOUSEMOVE Message ?

When the user use the mouse , Windows automatically moves the mouse cursor
on the Screen.The updating of the cursor position on the screen is done by low-level
logic within Windows.
 The lParam data passed with WM_MOUSEMOVE contains the mouse
cursor’s Position in the client area.The low order word contains the X
position and the high order word contains the Y position.

18.List the Notification Flag in the Mouse ?

 MK_CONTROL
 MK_LBUTTON
 MK_RBUTTON
 MK_MBUTTON
 MK_SHIFT

19.What are the client area Mouse Button Messages ?

 WM_LBUTTONDOWN
 WM_RBUTTONDOWN
 WM_MBUTTONDOWN
 WM_LBUTTONUP
 WM_LBUTTONUP
 WM_LBUTTONUP

20 . List the Cursor Shapes in the Windows Programming ?

 IDC_ARROW
 IDC_CROSS
 IDC_IBEAM
 IDC_ICON
21. What is Character Set ?

The Computers store and transmit letters and digits using coding systems.
Each Character is given a number code.A collection of characters, all the given
number codes are called “Character Set”.

22.What is the use of Virtual Key Code ?

The Virtual Key Codes are one of the ways Windows make sure that a
program written for one type of computer Keyboard will function properly on
another type. The Virtual Key codes are defined in WINDOWS.H.
 The Only Key which does not have a Virtual key code is ALT Key.

23.List the Menu Creation Functions ?


1.CreateMenu( )
2.CreatePopupMenu( )
3.SetMenu( )
4.AppendMenu( )
5.InsertMenu( )

24.What are the System Menus?


 SC_CLOSE
 SC_MOVE
 SC_RESTORE
 SC_MINIMIZE
 SC_MAXIMIZE
 SC_SIZE
 SC_TASKLIST

25.Define a Program Instance ?

Each running copy of a program is called a “Program Instance”.


The most oftenly used instances are HINSTANCE , HPREINSTANCE etc.

**********************************************

END

***********************************************

You might also like