WINDOWS PROGRAMMING
1.What is Windows Programming?
Windows Programming uses GUI conc~pt. It is an eventdriven programming. An Application Window will respond to the events. by generating a message by, the Operating. System. It uses. graphics for organizing user workspace. Programs that run within Windows also use GUI. (e.g.):. Word, Excel . These application programs use some built-in functions present in API.
2.Differentiate between DOS based programming .&Wind,ow based programming. .
DOS based Programming
1. Hardware Dependent
2. Activated when the OS is called
3. Never calls the pro&ram running under it .
Window Based Programming
1. Hardware'lndependent
2. Activated when it receives the message
3. Can call a program running, under it
3.List the main header files in windows programming?
* WINDOWS.H
* WINDEF.H
* WINNT.H
* WINBASE.H
* WINUSER.H
* WINGDI.H
4. What is an API?
API stands for Application Programming Interface. API is a set of commands that interfaces program with processor. It is a set of routines, protocols and tools for developing a software application. API programs are written in C Language. .
5. Write the ways of implementing API?
API. can be implemented by using libraries(win32.dll)
- kernel
- User
- GDI .
6.What are the uses of kernel, user and GDI Libraries?
- The kernel is responsible for management operation, context switching, and process
loading
- The user is used for manipulating the user interface.
- Graphical Device Interface (GDI) for graphical output and store of images.
7.Name any platform independent API?
Platform independent API is portable to any OS.
There are two platforms independent APIs
i) WIN16
ii) WIN32
8. What is Hungarian Notation?
The naming convention for windows programming is called as Hungarian Notation . In this notation the variable names are preceded with key letters. The key letters describe the type of data the variable represents.
e.g.,
h handle
sz character string terminated by zero
9. What are the steps required to create a window?
The steps required to create a window are,
a) Registering Window Class
b) Create a Window
c) MessageLoop
d) Window Procedure
10.How to register a window class?
Before creating an application window. the window class must be registered. Window class is registered by calling register class. This f'unction requires a single parameter, which is a pointer to structure of, type WNDCLASS
11.What is a window class?
A Window is always created using a window Class. The window, class identifies the window procedure that processes messages to the window. The Window class defines the window procedure and some other characterizing of window that created based on the class
12.Define Message Loop?
When a windows program begins execution, a window creates a "message queue" for the program; this message queue stores messages to all the windows a program might create. A windows application includes is short check of code called the message loop to retrieve those messages from the queue and dispatch them to the appropriate window procedure. A simple message to enters of one function call to each of three functions,GetMessage , TranslateMessage and DispatchMessage .
13.What is the use of TranslateMessage?
A Message Loop include Translate message, if the message loop receive character input from the keyboard, the system generates virtual key messages CW_ KEYDOWN and WM_ KEYUP each time the user process a key.
14.What is the use of Dispatch Message?
The Dispatch Message function sends a: message to the window procedure associated with the window handle specified in the MSG structure.
15.What are the actions of windows procedure?
The windows procedure is the function named Wndproc. The Window procedure deteimines what the window displays in its client area the window responds to user input.
A window procedure is defined as,
LRESULT CALLBACK WndProc(HWND hwnd , UINT message, WPARAM wParam, LPARAM IParam)
16.What is the value r.eturned from GetMessage?
Getmessage returns a non-zero value for anything other than WM_QUIT message. A WM_QUIT message causes Getmessage toreturn zero.
17. What IS WM_PAINT message?
This message informs when a part or all.of the windows client area is "invalid" and must be "updated" which means that it must be redrawn or "painted".
18. How does a client area become invalid?
The client area is invalid when
- The window is created first
- The window is resized
- The window is minimized
- The window is moved around the screen so that they overlap .
19. How does WMPAINT message is processed?
WMPAINT processing almost always begins with a call to Begin paint.
hdcBeginPaint (hwnd,&ps);
and ends with a call to EndPaint
EndPaint (hwnd,&Ps);
BeginPaint erases the backround, EndPaint releases the device context handle.
20.What is WM_DESTROY message?
WM_DESTROY message indicates that a window is.in the process of destroying a window based on a command from the,user; The message is a result of the user clicking on the close button or selecting close from the program's System message.
21.How the program is terminated?
When the PostQuit message function is invoked it inserts a WM_QUIT message in the Program's message queue. GetMessage returns zero for WM_QUIT message. This causes WinMain to drop put of the Message Loop. The program then returns msgWParam, The program tenninated.
22. What is GDI?
The Graphics Device Interface (GDI) provides functions .and related structures that an application can use to generate graphical output for displays, printers and other devices.
23. Define Scroll bar and what are are the messages generated?
A Scroll bar is a rectangle that contains a scroll bar and has direction arrows at both ends. The user can click the arrows, click on .the gray area between the arrows, or drag the Scrollbox to scroll the scroll bar's parent window. The messages are WM_HSCROLL and WM_VSCROLL
24.What is a keyboard accelerator? \Y!1at are the messages generated?
A Keystroke or combination of keystrokes that sends a command message to the specified application window is called a keyboard accelerator.
The messages generated are;
WM_COMMAND
WM _KEYUP
WM _KEYDOWN
WM _SYSKEYUP
WM_SYSCOMMAND
WM _SYSKEYDOWN
25.What is a menu? What are its types?
A Menu is a GUI, which contains a list of menu items. The types of menu are,
1. System Menus
2. Popup Menu
3. Dropdown Menu
26.What are the functions of messagebox function?
Message Box function is used to deliver text output to user. This function creates a window, but, it is a special purpose window of limited flexibility. The message box window has a title bar with a close button an optional icon, one or more lines of text.
27.What are queued and non queued messages?
The.queued messages are those that are placed in a programs message queue by windows. The queued messages are posted to a message queue. The non queued messages are the results of calls by windows directly to the window procedure.
28.When does the window procedure receives a WM_PAINT message?
a) When a previous hidden area of the. window is brought into view when ,a user
moves a window, or uncovers a window
b) The user resizes the window (if the window class style has set bits) .
c) The program user the scroll window or scroll dc function to scroll part of its
client area. .
d) The program uses the invalidaterect or invalidates RG function.
a) Function that get and release a device context
b) Function that obtain information about device context
c) Functions that draw something
d) Functions that set and get attributes of the device context
e) Functions that work with GDI objects
30.What are the seven functions supported by windows 98 to draw lines?
- Lineto - draws a straight line
- Poly line and poly line co - draw a series of connected straight lines
- Polyline - Draws multiple poly line
- Arc - Draws eliptical1ine
- Poly Bezier and polybezierlo - draw Bezier splines
- Arc to and angle arc - draw elliptical line
- Poly draw - draws a series of connected Hnes and. Bezier splines
No comments:
Post a Comment