You are on page 1of 37

PART - A

1.What is GDI?

Many MS-DOS programs wrote directly to the video memory and the printer port. The
disadvantage of this technique was the need to supply driver software for every video
board and every printer model. Windows introduced a layer of abstraction called the
Graphics Device Interface (GDI).

2.What is Device context?

Windows provides the video and printer drivers, so your program doesn\'t need to know
the type of video board and printer attached to the system. Instead of addressing the
hardware, your program calls GDI functions that reference a data structure called a
device context. Windows maps the device context structure to a physical device and
issues the appropriate input/output instructions. The GDI is almost as fast as direct video
access, and it allows different applications written for Windows to share the display.

3.What is DLL?

Windows allows dynamic linking, which means that specially constructed libraries can be
loaded and linked at runtime. Multiple applications can share dynamic link libraries
(DLLs), which saves memory and disk space. Dynamic linking increases program
modularity because you can compile and test DLLs separately. Designers originally
created DLLs for use with the C language, and C++ has added some complications. The
MFC developers succeeded in combining all the application framework classes into a few
ready-built DLLs. This means that you can statically or dynamically link the application
framework classes into your application. In addition, you can create your own extension
DLLs that build on the MFC DLLs..

4.Name some basic Header files?

WINDOWS.H is a master include file that includes other Windows header files, some of
which also include other header files. The most important and most basic of these header
files are:

• WINDEF.H Basic type definitions.

• WINNT.H Type definitions for Unicode support.


• WINBASE.H Kernel functions.

• WINUSER.H User interface functions.

• WINGDI.H Graphics device interface functions.

5.What is message box function?

The MessageBox function is designed to display short messages. The little window that
MessageBox displays is actually considered to be a dialog box, although not one with a
lot of versatility. The first argument to MessageBox is normally a window handle.. The
second argument is the text string that appears in the body of the message box, and the
third argument is the text string that appears in the caption bar of the message box. In
HELLMSG.C, each of these text strings is enclosed in a TEXT macro.

6.Name some Window function calls?

• LoadIcon Loads an icon for use by a program.

• LoadCursor Loads a mouse cursor for use by a program.

• GetStockObject Obtains a graphic object, in this case a brush used for painting the
window\'s background.

• RegisterClass Registers a window class for the program\'s window.

• MessageBox Displays a message box.

• CreateWindow Creates a window based on a window class.

• ShowWindow Shows the window on the screen.

• UpdateWindow Directs the window to paint itself.

7.What is message Loop?

After the UpdateWindow call, the window is fully visible on the video display. The
program must now make itself ready to read keyboard and mouse input from the user.
Windows maintains a \"message queue\" for each Windows program currently running
under Windows. When an input event occurs, Windows translates the event into
a \"message\" that it places in the program\'s message queue.
A program retrieves these messages from the message queue by executing a block of
code known as the \"message loop\":

8.What is WM_DESTROY message?

The WM_DESTROY message is another important message. This message indicates that
Windows 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 menu. (Later in this chapter, I\'ll discuss in more detail how the
WM_DESTROY message gets generated.)

HELLOWIN responds to the WM_DESTROY message in a standard way by calling

PostQuitMessage (0) ;

9.Name the functions involved in WM_PAINT message.

In WM_PAINT messages. Two functions are involved: BeginPaint and EndPaint. These
two functions require the handle to the window, which is passed to the window procedure
as an argument, and the address of a structure variable of type PAINTSTRUCT, which is
defined in the WINUSER.H header file.

10.Name some Graphics primitives.

• Lines and curves

• Filled areas

• Bitmaps

• Text

11.What is TextOut?
TextOut is the most common GDI function for displaying text. Its syntax is

TextOut (hdc, x, y, psText, iLength) ;

The first argument is the handle to the device context—either the hdc value returned from
GetDC or the hdc value returned from BeginPaint during processing of a WM_PAINT
message.

12.What is System font?

The device context also defines the font that Windows uses when you call TextOut to
display text. The default is a font called the \"system font\" or (using the identifier in the
WINGDI.H header file) SYSTEM_FONT. The system font is the font that Windows uses
by default for text strings in title bars, menus, and dialog boxes.

13.What are the Windows\' responsibilities for scroll bars?

• Handle all processing of mouse messages to the scroll bar.

• Provide a reverse-video \"flash\" when the user clicks the scroll bar.

• Move the thumb as the user drags the thumb within the scroll bar.

• Send scroll bar messages to the window procedure of the window containing the scroll
bar.

14.Name some Scroll bar messages?

Windows sends the window procedure WM_VSCROLL (vertical scroll) and


WM_HSCROLL (horizontal scroll) messages when the scroll bar is clicked with the
mouse or the thumb is dragged. Each mouse action on the scroll bar generates at least two
messages, one when the mouse button is pressed and another when it is released.

Like all messages, WM_VSCROLL and WM_HSCROLL are accompanied by the


wParam and lParam message parameters. For messages from scroll bars created as part of
your window, you can ignore lParam; that\'s used only for scroll bars created as child
windows, usually within dialog boxes.

15.Name the Keystroke messages.?

Key Pressed Key Released

Nonsystem Keystroke: WM_KEYDOWN WM_KEYUP


System Keystroke: WM_SYSKEYDOWN WM_SYSKEYUP

16.Name the Character messages?

Characters Dead Characters

Nonsystem Characters: WM_CHAR WM_DEADCHAR

System Characters: WM_SYSCHAR WM_SYSDEADCHAR

17.Name the Mouse messages?

Button Pressed Released Pressed (Second Click)

Left WM_LBUTTONDOWN WM_LBUTTONUP WM_LBUTTONDBLCLK

Middle WM_MBUTTONDOWN WM_MBUTTONUP WM_MBUTTONDBLCLK

Right WM_RBUTTONDOWN WM_RBUTTONUP WM_RBUTTONDBLCLK

18.What is Mouse wheel?

\"Build a better mousetrap and the world will beat a path to your door,\" my mother told
me, unknowingly paraphrasing Emerson. Of course, nowadays it might make more sense
to build a better mouse.The Microsoft IntelliMouse features an enhancement to the
traditional mouse in the form of a little wheel between the two buttons. You can press
down on this wheel, in which case it functions as a middle mouse button, or you can turn
it with your index finger. This generates a special message named
WM_MOUSEWHEEL. Programs that use the mouse wheel respond to this message by
scrolling or zooming a document.

19.Define Menu structure?

When you create or change menus in a program, it\'s useful to think of the top-level menu
and each popup menu as being separate menus. The top-level menu has a menu handle,
each popup menu within a top-level menu has its own menu handle, and the system menu
(which is also a popup) has a menu handle.

Each item in a menu is defined by three characteristics. The first characteristic is what
appears in the menu. This is either a text string or a bitmap. The second characteristic is
either an ID number that Windows sends to your program in a WM_COMMAND
message or the handle to a popup menu that Windows displays when the user chooses
that menu item. The third characteristic describes the attribute of the menu item,
including whether the item is disabled, grayed, or checked.

20.What are the features of Win 32 application programming interface?

Early Windows programmers wrote applications in C for the Win16 application


programming interface (API). Today, if you want to write 32-bit applications, you must
use the new Win32 API, either directly or indirectly. Most Win16 functions have Win32
equivalents, but many of the parameters are different—16-bit parameters are often
replaced with 32-bit parameters, for example. The Win32 API offers many new
functions, including functions for disk I/O, which was formerly handled by MS-DOS
calls. With the 16-bit versions of Visual C++, MFC programmers were largely insulated
from these API differences because they wrote to the MFC standard, which was designed
to work with either Win16 or Win32 underneath.

PART – B

1. Explain in detail about various versions of Windows Operating System(16)

2. Explain briefly about,

a. How to create a window (6)

b. Displaying the window (4)

c. Processing the message (6)

3. a. Describe the functions of Message Loop (8)

b. Explain in detail about the Windows Message Structure and Windows

Procedure. (8)

4. a. How does the WM_PAINT message is processed? (10)


b. What is WM_DESTROY message? How the program is terminated? (6)

5. a. Define DC. (2)

b. What are the methods available to get the DC and various types of DC

Handle? (14)

6. Explain Windows Graphics Device Interface in detail (16)

7. a. Write a note on Hungarian Notation in Windows Programming (6)

b. Write a program to display a message in the center of a window (10)

8. a. Explain the methods of getting device context handle (8)

b. Briefly discuss the various child window button controls (8)

• Unit I
• Unit II
• Unit III
• Unit IV
• Unit V

PART - A

1.What are the primary windows inside the Visual Basic environment.?

Form

Toolbox

Project

Properties

Code
2. What is a form?

Forms are the basic element of the user interface in a Visual Basic application. They
provide a framework you can use throughout your application to give a consistent look
and feel. Differences in user interface design and behavior from one application to
another, or within one application, can result in increased training and support costs. In a
corporate environment, enforcing a consistent user interface across all of your
applications can help reduce those costs.

3. Name some form events.

• Initialize

• Load

• Activate

• Deactivate

• QueryUnload

• Unload

• Terminate

4. Name some form methods.

• Load

• Unload

• Hide

• Show

5. Name some properties of form.

Appearance

AutoRedraw

BackColor
BorderStyle

Caption

6.What are the basic data types available in VB?

Integer

Long

Single

Double

Currency

String and variant

7. What is DIM?

Dim—short for dimension—is a Visual Basic statement that you write in an application\'s
Code window. Whenever you learn a new statement, you need to learn the format for that
statement. Here is the format of the Dim statement:

Dim VarName AS DataType

8. Give the syntax for creating constants?

Const CONSTANT_NAME [As ConstantType] = value

9. What is Sub?

Subs enable you to change code easily. If you have a body of code that you need to use
repeatedly, put the code in a sub. Then, if you need to make a change in the code, simply
go to the sub to make changes. If you don\'t put the code in a sub, you will have to go to
every instance of the code in your program to make the required change. The more
dispersed your code is, the harder it is to make changes effectively and efficiently.

A sub is a procedure that executes the lines of code within its block but doesn\'t return a
value. The syntax for a simple sub is as follows:

[Private|Public] Sub SubName()

.....lines of code

End Sub

10. Give the format of nested If?

The format for a nested If statement is as follows:

If condition Then

If another_condition Then

statement

Else

another statement

End If

End If

11.Give the structure of select case?


The Select Case structure is similar to a series of If...Then...ElseIf statements. The
following lines of code show the syntax of the Select Case block:

Select Case TestValue

Case Value1

Statement_Group_1

Case Value2

Statement_Group_2

End Select

12. What is a Control array?

Definition—A control array is a list of controls with the same name.

When you place more than one control of the same control type on a form and assign the
same Name property to those controls, you\'re creating a control array. As with variable
arrays, a subscript that begins at 0 differentiates one control from another. The Index
property of each control in the array contains that control\'s subscript location in the
array. If you want to renumber the controls in the array to begin at 1, you can do so by
changing the first zero-based control\'s Index value to 1.

If there were five text boxes in a control array named txtBoxes, the individual controls
would be named txtBoxes(0), txtBoxes(1), txtBoxes(2), txtBoxes(3), and txtBoxes(4).

13. Give the features of Menu editor?

The Menu Editor window is a dialog box that you access from the Form window by
pressing Ctrl+E or by selecting Tools Menu Editor from Visual Basic\'s own menu bar.
Editor window and names the parts of the Menu Editor window.

The Menu Editor window creates your menu, but you still need to write event procedures
that tie menu command selections to actions taken by your application. When the user
selects a menu command, Visual Basic generates an event, just as it generates an event
when the user clicks a command button.

14.What is a dialog box?

A dialog box is a small window used to display or accept information. Its name comes
from the fact that it is, in essence, a dialog (or conversation) with the user. A dialog box
is usually shown modally, which means the user must close it (or \"answer the dialog\")
before continuing with any other part of the program. This chapter looks at two dialog
boxes built in to the Visual Basic language: the message box and the input box. Next, you
use the CommonDialog custom control, which allows you to place four types of standard
dialog boxes in your program. Finally, you see some guidelines for creating your own

form-based dialog box.

15. How does an option button limit its choices?

Unlike check boxes, option buttons give your users a list from which to choose, but they
can select exactly one option out of the list. Often, the option button controls are known
as mutually-exclusive controls. Unless you group sets of option buttons in frames
(described later in this unit), the user can select one and only one option

button at a time.

Click the Next Control command button to see the CONTROLS.VBP option buttons on
your screen With the mouse, click one of the option buttons. Click another option button.
At once, Visual Basic deselects the first option button and selects the one you just
clicked. Select another option button to change the selected option once again. As you
can see, Visual Basic ensures that you can select only one option at a time. Instead of
check boxes, which permit multiple selections, you would display option buttons for the
user whenever he can make only one choice out of several.
16. What is a frame?

Although the user can select only one option button at a time, you can set up groups of
option buttons on the same form. The user can then select one option button at a time
from within each frame.

Definition—A frame is a box in which you can place control groups.

You must always enclose the group within a frame by using the Frame Control. If you
press the Next Control button again, you will see a frame appear in the middle of the
form If three frames of option button groups appeared on the form, you could select a
maximum of three option buttons on the form—one in each framed set.

17. What is a debugger?

Definition—A debugger is the integrated tool that helps you find program bugs.

there are two general categories of errors that you\'ll often run across as you use Visual
Basic. The debugger can help you locate and fix these errors. You will find both syntax
errors and logic errors.

18. What are the events most often associated with the mouse.

Click

Generated when the user clicks a mouse button

DblClick

Generated when the user double-clicks a mouse button

MouseDown

Generated when the user presses a mouse button

MouseMove
Generated when the user moves the mouse

MouseUp

Generated when the user lets up on a mouse button

RightClick

Generated when the user clicks the right mouse button

19. What is grid control?

The grid control produces a table of rows and columns in which you can display text,
numeric values, and even graphics.

When you must display several values at once, the grid control is one of the handiest
controls to use. Although labels are great for messages and individual data items, and
scrolling list boxes are fine for lists of values from which the user can select, the grid
gives your application a two-dimensional table display of data.

Suppose that you just started a lawn fertilization company, and you begin with an initial
route of eight customers. Each customer requires five annual fertilizations. That\'s a total
of 40 applications that you need to track for the upcoming year. Each yard size differs
and each application requires different amounts and kinds of fertilization mixtures.

Definition—A cell is one row and column intersection of a grid.

20. What is common dialog box control ?

The common dialog box control produces these kinds of dialog boxes that look and act
just like other Windows 95 programs\' equivalent dialog boxes: Color: Displays a
selection of colors from which the user can select. File Open: Displays the File Open
dialog box from which the user can select (or type) a file to open.

File Save: Displays the File Save dialog box in which the user can select (or type) file in
which to save the current data.
Fonts: Displays a list of fonts available on the target system from which the user can
select.

Printer: Displays a Printer dialog box from which the user can select printing choices
such as the number of copies desired.

WinHelp: Starts the WinHelp program, a program that asks the user for a help file that
the WinHelp program will then open.

21. What is a recordset?

Recordset

A group of records, created by a query, from one or more tables in a database. The
records in a recordset are typically a subset of all the records in a table. When the
recordset is created, the number of records and the order in which they\'re presented can
be controlled by the query that creates the recordset.

PART – B

1. Explain about the form properties and Methods?

2. What are subs and explain about Main() scope?

3. Explain the various control statements with examples?

4. Write note on control arrays?


5. How to add item to menu bar and explain about pull down menu?

6. Explain about input box and its features?

7. Explain about Message box and its features?

8. Write note on basic controls available in VB?

9. Discuss about classes and object instances.

10. Write a note on debugging routine?

11. Explain about Keyboard and mouse events?

12. Write notes on GRID control.

13. Explain about graphics, line and shape controls.

14. Give the procedure to connect to database through data controls.

15. Explain about file controls and file processing

PART - A

1.What are the Two parameters are passed to the list view control?

Two parameters are passed to the list view control: the address of the image list and a
style parameter that indicates the type of images stored in the image list

2. Name some image list types.

There are three image list types.

LVSIL_NORMAL is used for the image list used in the icon view.

LVSIL_SMALL is used for the image list used in the small icon view.

LVSIL_STATE is used for optional state images, such as check marks.


3.How to insert a list view item?

The InsertItem function is used to add an item to a list view control:

m_listItem.InsertItem( &listItem );

A pointer to an LV_ITEM structure is passed as the parameter to InsertItem. LV_ITEM


data members are filled with data for the new item before it is inserted.

listItem.mask = LVIF_TEXT;

listItem.iItem = 0;

listItem.pszText = szText;

m_listCtrl.InsertItem( &listItem );

4.Give the features of tree view control?

In a tree view, parent items are located at the root, or top level, of the tree. In a tree view,
child items are located under parent items.

Items in a tree view control are arranged into groups, with child items located under
parent items. Child items are also indented, or nested, under a parent. A child item at one
level can be the parent of child items at lower levels. The Windows Explorer is one of the
applications that uses the new tree control

The tree control is a popular control because it enables you to display a great deal of
information in a hierarchy. Unlike a list box, a small amount of high-level information
can be presented initially, enabling the user to decide which parts of the tree should be
expanded. The tree control also enables information to be displayed so that relationships
between different items in the control can be seen. For example, in the Explorer,
subdirectories are nested in order to show their positions in the directory.
5. How to Apply Styles to a Tree View Control?

Four style options specifically to a tree view control:

TVS_HASLINES adds connecting lines between parent and child items.

TVS_LINESATROOT adds lines for the root items in the tree control. This attribute is
ignored if TVS_HASLINES is not selected.

TVS_HASBUTTONS adds the plus and minus buttons for items that can be expanded.

TVS_EDITLABELS enables the user to edit a tree view item label.

6.What is a slider control?

A slider control, also known as a trackbar control, is a control that contains a slide bar
that you can move between two points. A slider is used in the Display applet that is part
of the Windows Control Panel. The Settings property page uses a slider to set the screen
resolution.

The user moves the slide bar by dragging it with the mouse or by setting the keyboard
focus to the slider and using the arrow keys on the keyboard. You can create sliders with
optional tick marks that help the user to judge the position of the slide bar.

7.What is progress control?

A progress control, also known as a progress bar, is commonly used to indicate the
progress of an operation and is usually filled from left to right as the operation is
completed. You can also use progress controls to indicate temperature, water level, or
similar measurements. In fact, an early term for this type of control was \"Gas Gauge,\"
back in the old days when programmers had mules and most Windows programs were
written in C.

Progress controls are used in Developer Studio to indicate the progress of saving or
loading a project workspace. Progress controls are also used by the Windows Explorer
when copying or moving files.

A progress control is added to a dialog box in the same way as the up-down and slider
controls discussed earlier. Using the Developer Studio dialog box editor, add a progress
control to the Controls project main dialog box.

8.State the features of Modal and modeless dialog box?

The CDialog base class supports both modal and modeless dialogs. With a modal dialog,
such as the Open File dialog, the user cannot work elsewhere in the same application
(more correctly, in the same user interface thread) until the dialog is closed. With a
modeless dialog, the user can work in another window in the application while the dialog
remains on the screen. Microsoft Word\'s Find and Replace dialog is a good example of a
modeless dialog; you can edit your document while the dialog is open.

9. How to add a dialog control at runtime?

1. Add an embedded control window data member to your dialog class. The MFC control
window classes include CButton, CEdit, CListBox, and CComboBox. An embedded
control C++ object is constructed and destroyed along with the dialog object.

2. Choose Resource Symbols from Visual C++\'s View menu. Add an ID constant for the
new control.

3. Use ClassWizard to map the WM_INITDIALOG message, thus overriding


CDialog::OnInitDialog. This function should call the embedded control window\'s Create
member function. This call displays the new control in the dialog. Windows will destroy
the control window when it destroys the dialog window.

4. In your derived dialog class, manually add the necessary notification message handlers
for your new control.
10.What is a progress indicator control?

The progress indicator is the easiest common control to program and is represented by the
MFC CProgressCtrl class. It is generally used only for output. This control, together with
the trackbar, can effectively replace the scroll bar controls you saw in the previous
example. To initialize the progress indicator, call the SetRange and SetPos member
functions in your OnInitDialog function, and then call SetPos anytime in your message
handlers. The progress indicator shown in Figure 6-2 has a range of 0 to 100, which is the
default range.

11.What is trackbar control?

The trackbar control (class CSliderCtrl), sometimes called a slider, allows the user to set
an \"analog\" value. (Trackbars would have been more effective than sliders for Loyalty
and Reliability in the EX06A example.) If you specify a large range for this control—0 to
100 or more, for example—the trackbar\'s motion appears continuous. If you specify a
small range, such as 0 to 5, the tracker moves in discrete increments. You can program
tick marks to match the increments. In this discrete mode, you can use a trackbar to set
such items as the display screen resolution, lens f-stop values, and so forth. The trackbar
does not have a default range.

The trackbar is easier to program than the scroll bar because you don\'t have to map the
WM_HSCROLL or WM_VSCROLL messages in the dialog class. As long as you set the
range, the tracker moves when the user slides it or clicks in the body of the trackbar. You
might choose to map the scroll messages anyway if you want to show the position value
in another control. The GetPos member function returns the current position value. The
top trackbar in Figure 6-2 operates continuously in the range 0 to 100. The bottom
trackbar has a range of 0 to 4, and those indexes are mapped to a series of double-
precision values (4.0, 5.6, 8.0, 11.0, and 16.0).

12.What is spin button control?

The spin button control (class CSpinButtonCtrl) is an itsy-bitsy scroll bar that\'s most
often used in conjunction with an edit control. The edit control, located just ahead of the
spin control in the dialog\'s tabbing order, is known as the spin control\'s buddy. The idea
is that the user holds down the left mouse button on the spin control to raise or lower the
value in the edit control. The spin speed accelerates as the user continues to hold down
the mouse button.

If your program uses an integer in the buddy, you can avoid C++ programming almost
entirely. Just use ClassWizard to attach an integer data member to the edit control, and
set the spin control\'s range in the OnInitDialog function. (You probably won\'t want the
spin control\'s default range, which runs backward from a minimum of 100 to a
maximum of 0.) Don\'t forget to select Auto Buddy and Set Buddy Integer in the spin
control\'s Styles property page. You can call the SetRange and SetAccel member
functions in your OnInitDialog function to change the range and the acceleration profile.
13.What is tree control?

The MFC CTreeCtrl class makes it easy to add this same functionality to your own
programs The user can expand and collapse elements by clicking the + and - buttons or
by double-clicking the elements. The icon next to each item is programmed to change
when the user selects the item with a single click.

The list control and the tree control have some things in common: they can both use the
same image list, and they share some of the same notification messages. Their methods of
identifying items are different, however. The tree control uses an HTREEITEM handle
instead of an integer index. To insert an item, you call the InsertItem member function,
but first you must build up a TV_INSERTSTRUCT structure that identifies (among other
things) the string, the image list index, and the handle of the parent item (which is null for
top-level items).

14. Name some window common dialog classes?

Class Purpose

CColorDialog Allows the user to select or create a color

CFileDialog Allows the user to open or save a file

CFindReplaceDialog Allows the user to substitute one string for another

CPageSetupDialog Allows the user to input page measurement parameters

CFontDialog Allows the user to select a font from a list of available fonts

CPrintDialog Allows the user to set up the printer and print a document

15. What is message Loop?

After the UpdateWindow call, the window is fully visible on the video display. The
program must now make itself ready to read keyboard and mouse input from the user.
Windows maintains a \"message queue\" for each Windows program currently running
under Windows. When an input event occurs, Windows translates the event into
a \"message\" that it places in the program\'s message queue.

A program retrieves these messages from the message queue by executing a block of
code known as the \"message loop\":
PART – B

1. How the COM Client interacts with Inprocess Component. (16)

2. a. What are the steps involved to create an ActiveX control at run

time (6)

b. What are the steps involved in OLE Drag & Drop (10)

3. Explain the features of OLE container – component interactions (16)

4. Explain in detail ActiveX control container programming with

example (16)

5. Write a short notes on

a. IUnknown Interface and QueryInterface Member function (10)

b. Reference Counting (6)

6. Write a short notes on

a.Class Factory (8)

b.Containment & Aggregation Vs Inheritance (8)

7. a. Write a COM class using multiple inheritance approach (8)

b. Discuss the container interfaces (8)

8. a. Highlight the features of the control (8)

b. Explain the steps involved in the installation of ActiveX control(8)

9. Write down the steps to create a VC++ program that encapsulates the

menu, keyboard accelerator and tool bar to draw a circle and

rectangle and show the output. (16)


10. a. What is Rich Edit control & Discuss the supporting MFC classes for

the control. (8)

b. Discuss the Menu item properties (8)

PART - A

1.What is a linker?

The linker reads the OBJ and RES files produced by the C/C++ compiler and the
resource compiler, and it accesses LIB files for MFC code, runtime library code, and
Windows code. It then writes the project\'s EXE file. An incremental link option
minimizes the execution time when only minor changes have been made to the source
files. The MFC header files contain #pragma statements (special compiler directives) that
specify the required library files, so you don\'t have to tell the linker explicitly which
libraries to read.

2. What is application wizard?

AppWizard is a code generator that creates a working skeleton of a Windows application


with features, class names, and source code filenames that you specify through dialog
boxes. You\'ll use AppWizard extensively as you work through the examples in this
book. Don\'t confuse AppWizard with older code generators that generate all the code for
an application. AppWizard code is minimalist code; the functionality is inside the
application framework base classes. AppWizard gets you started quickly with a new
application.

Advanced developers can build custom AppWizards. Microsoft Corporation has exposed
its macro-based system for generating projects. If you discover that your team needs to
develop multiple projects with a telecommunications interface, you can build a special
wizard that automates the process.

3.What is class wizard?

ClassWizard is a program (implemented as a DLL) that\'s accessible from Visual C++\'s


View menu. ClassWizard takes the drudgery out of maintaining Visual C++ class code.
Need a new class, a new virtual function, or a new message-handler function?
ClassWizard writes the prototypes, the function bodies, and (if necessary) the code to link
the Windows message to the function. ClassWizard can update class code that you write,
so you avoid the maintenance problems common to ordinary code generators
4. What are viewing modes of source browser?

The browser has the following viewing modes:

• Definitions and References—You select any function, variable, type, macro, or class
and then see where it\'s defined and used in your project.

• Call Graph/Callers Graph—For a selected function, you\'ll see a graphical


representation of the functions it calls or the functions that call it.

• Derived Classes and Members/Base Classes and Members—These are graphical class
hierarchy diagrams. For a selected class, you see the derived classes or the base classes
plus members. You can control the hierarchy expansion with the mouse.

• File Outline—For a selected file, the classes, functions, and data members appear
together with the places in which they\'re defined and used in your project.

5. What are the modules managed by Gallery?

The Visual C++ Components and Controls Gallery lets you share software components
among different projects. The Gallery manages three types of modules:

• ActiveX controls—When you install an ActiveX control (OCX—formerly OLE


control), an entry is made in the Windows Registry. All registered ActiveX controls
appear in the Gallery\'s window, so you can select them in any project.

• C++ source modules—When you write a new class, you can add the code to the
Gallery. The code can then be selected and copied into other projects. You can also add
resources to the Gallery.

• Visual C++ components—The Gallery can contain tools that let you add features to
your project. Such a tool could insert new classes, functions, data members, and
resources into an existing project. Some component modules are supplied by Microsoft
(Idle time processing, Palette support, and Splash screen, for example) as part of Visual
C++. Others will be supplied by third-party soft-ware firms.

6. What is an application framework?

An application framework is a superset of a class library. An ordinary library is an


isolated set of classes designed to be incorporated into any program, but an application
framework defines the structure of the program itself. Microsoft didn\'t invent the
application framework concept. It appeared first in the academic world, and the first
commercial version was MacApp for the Apple Macintosh.
7. Differentiate SDI and MDI.

The MFC library supports two distinct application types: Single Document Interface
(SDI) and Multiple Document Interface (MDI). An SDI application has, from the user\'s
point of view, only one window. If the application depends on disk-file \"documents,\"
only one document can be loaded at a time. The original Windows Notepad is an example
of an SDI application. An MDI application has multiple child windows, each of which
corresponds to an individual document. Microsoft Word is a good example of an MDI
application.

When you run AppWizard to create a new project, MDI is the default application type.
For the early examples in this book, you\'ll be generating SDI applications because fewer
classes and features are involved. Be sure you select the Single Document option (on the
first AppWizard screen) for these examples. The MFC library application framework
architecture ensures that most SDI examples can be upgraded easily to MDI applications.

8. Write note on OnDraw member function.

. OnDraw is a virtual member function of the CView class that the application framework
calls every time the view window needs to be repainted. A window needs to be repainted
if the user resizes the window or reveals a previously hidden part of the window, or if the
application changes the window\'s data. If the user resizes the window or reveals a hidden
area, the application framework calls OnDraw, but if a function in your program changes
the data, it must inform Windows of the change by calling the view\'s inherited Invalidate
(or InvalidateRect) member function. This call to Invalidate triggers a later call to
OnDraw.

Even though you can draw inside a window at any time, it\'s recommended that you let
window changes accumulate and then process them all together in the OnDraw function.
That way your program can respond both to program-generated events and to Windows-
generated events such as size changes.

9. How to initialize a view class data member?

The most efficient place to initialize a class data member is in the constructor, like this:
CMyView::CMyView() : m_rectEllipse(0, 0, 200, 200) {...}

You could initialize m_nColor with the same syntax. Because we\'re using a built-in type
(integer), the generated code is the same if you use an assignment statement in the
constructor body.

10. Name some GDI derived classes?

• CBitmap—A bitmap is an array of bits in which one or more bits correspond to each
display pixel. You can use bitmaps to represent images, and you can use them to create
brushes.

• CBrush—A brush defines a bitmapped pattern of pixels that is used to fill areas with
color.

• CFont—A font is a complete collection of characters of a particular typeface and a


particular size. Fonts are generally stored on disk as resources, and some are device-
specific.

• CPalette—A palette is a color mapping interface that allows an application to take full
advantage of the color capability of an output device without interfering with other
applications.

• CPen—A pen is a tool for drawing lines and shape borders. You can specify a pen\'s
color and thickness and whether it draws solid, dotted, or dashed lines.

• CRgn—A region is an area whose shape is a polygon, an ellipse, or a combination of


polygons and ellipses. You can use regions for filling, clipping, and mouse hit-testing.

11. What are fonts?

Fonts are an integral part of the Windows GDI. This means that fonts behave the same
way other GDI objects do. They can be scaled and clipped, and they can be selected into
a device context as a pen or a brush can be selected. All GDI rules about deselection and
deletion apply to fonts.

12. Differentiate color and monochrome bitmaps.


Many color bitmaps are 16-color. A standard VGA board has four contiguous color
planes, with 1 corresponding bit from each plane combining to represent a pixel. The 4-
bit color values are set when the bitmap is created. With a standard VGA board, bitmap
colors are limited to the standard 16 colors. Windows does not use dithered colors in
bitmaps.

A monochrome bitmap has only one plane. Each pixel is represented by a single bit that
is either off (0) or on (1). The CDC::SetTextColor function sets the \"off\" display color,
and SetBkColor sets the \"on\" color. You can specify these pure colors individually with
the Windows RGB macro

PART – B

1. Draw & Explain in detail about various components of VC++ (16)

2. Explain in briefly about

a. MM_TEXT Mapping Mode (5)

b. Fixed Scale Mapping Mode (4)

c. Variable Scale Mapping Mode (7)

3. a. Explain in detail about various types of video cards. (10)

b. How to compute Character height (6)

4. What is meant by Modal & Modeless dialog control? Explain Modal dialog

controls with a sample programs. (16)

5. a. Discuss about Window Common Controls (12)

b. What are different Mapping Modes available in VC++? (4)

6. a. Explain how to create an instance of color dialog & the functions

associated with it. (8)


b. Write a VC++ program to paint the background with a brush. Set the

color using the coordinates at which the mouse is clicked. (8)

7. a. Differentiate the modal & modeless dialog (4)

b. Write a VC++ program to create & display a modeless dialog (6)

c. Write a VC++ program to draw a rectangle as the mouse moves (6)

8. Explain SDI & MDI application in detail. (16)

9. a. What is Rich Edit control & Discuss the supporting MFC classes for

the control. (8)

b. Discuss the Menu item properties (8)

10.What are the functions performed in SDI application and Explain that

functions in detail (16)

2 Marks

120. What are the advantages of using a real DBMS?

i) Use of standard file formats

ii) Indexed file access

iii) Data integrity safeguards

iv) Multi-user access control

121.Expand the following; Blob, SDK, API, ODBC, DAO?

Blob - binary large object


SDK - software development kit

API - application programming interface

ODBC - open database connectivity

DAO - data access object

122. What is process and thread?

A process is a running program that owns its own memory, file handles and other

system resources. The separate execution paths that an individual process can contain are

called as threads.

123. What are the two kinds of thread?

Windows offers two kinds of threads namely

i) Works threads

ii) User interface thread

124.Define ODBC?

The Microsoft open database connectivity(ODBC) standard defines the rules of

SQL grammar and also the c-language programming interface to any SQL database. Any

DBMS that has an ODBC driver can be occurred by a single compiled c or c++ program

odbc thus separate the user interface from the actual database management process.

125.What are the methods of Binary Interface method?

The first three methods are:-


i) Query Interface() for navigating between interfaces of the same object

instance.

ii) AddRef() for incrementing reference counts.

iii) Release() for decrementing reference counts.

126.Write short notes on Threading Model.

If an application allows multiple clients to concurrently invoke methods of the

same COM object, some synchronization mechanisms needs to be provided to protect the

data. A partment is logical grouping of object that share the same concurrency

constraints, every COM process can have at most one multithread apartment but it can

contain multiple Single Thread Apartments(STAs).

127.What is MTS?

MTS stands for Microsoft Transaction Server provides another style of server

programming. MTS provides server objects, must be implemented in the form of DLLs

that are to be hosted by MTS surrogate processes. MTS provides context objects for these

server objects so that they can participate in transaction.

128.What is RFX and where is it used?

RFX is the acronym for Record Field Exchange. The MFC framework can move data

back and forth between the database and the member variables of your CRecordSet by

using record field exchange which works very much like the Dialog Data Exchange

mechanism used by the dialogs and controls.


129.What is the use of CRecordSet :: dynamic?

This type uses a dynamic cursor which allows scrolling in both directions. This type

of record set allow only forward scrolling will not reflect any changes made to the

database.

130.What are the steps to create sample database?

The steps are:-

i) Start MS Access

ii) Create a new table

iii) Populate the table

131. Write the general syntax to create a table. Give one example.

Syntax:-CREATETABLE: table-name({column name data type},……….)

Example:-

CREATE TABLE Employee

EmpID INTEGER,

EmpName VARCHAR(50)

Salary NUMERIC(6,2)

Exp NUMERIC(5) }

132. How to use Single Row Functions?

For functions such as CRecordSet:: GetField Value () which work on a single row
then you set the current row within row set. This is done with the set row

SetCursorPosition () member in CRecordSet.

133.What is Data transfer and what are its two structures?

Transferring data between application are accomplished through the one data

object interface which provides a mechanism for transferring data and also for

notifications of change in the data.

The two structures are:-

i) FORMATETC

ii) STGMEDIUM

134. List the MFCWinIent classes

i) CInternetSession

ii) CHttpConnectin

iii) CFtpConnection

iv) CGopherConnection

v) CInternetFile

vi) ChttpFile

vii) CFtpFileFind

viii) CGopherFileFind

ix) CinternetException

135. List the advantages of WinInet over Winsock

1. Caching
2. Security

3. Web proxy access

4. Buffered I/O

5. Easy API

6. User Friendly

136.Define ISAPI Server Extensions.

An ISAPI Server Extension is program that runs in response to a GET or POST

request from a client program. The Browser can pass parameters to the programs, which

are often values that the browser user types into edit, controls, selects from list boxes and

so forth. It typically sends back HTML code based on those parameter values.

137.List MFC ISAPI Server Extension classes

i) CHttpServer

ii) CHttpServerContext

iii) CHtmlStream

138. Define WINSOCK.

Winsock is the lowest level Windows API for TCP/IP programming. Part of the

code is located in wsock32.dll and part is inside the Windows kernel.

139.List the components of OLEDB Architecture.

i. Enumerators
ii. Data source objects

iii. Commands

iv. Row sets

v. Errors

vi. Transaction objects.

140.What is WinInet?

The WinInet (Windows Internet) is a higher-level API than winsock and is a

collection of high-level functions that assist a programmer in using three popular Internet

protocols: the Hypertext Transfer Protocol (HTTP) used for the World Wide Web, the

File Transfer Protocol (FTP), and another file transfer protocol known as Gopher in both

asynchronous and synchronous modes.

141. Define IIS.

Microsoft IIS (Internet Information Server) is a high-performance

Internet/Intranet server that takes advantage of Windows NT features such as I/O

completion ports, the win32 function TransmitFile, file-handle caching, and CPU scaling

for threads. IIS is a special kind of Win32 program called a service actually three

services-WWW, HTTP, and gopher - in one program called inetinfo.exe.

142.Define ISAPI.

An ISAPI (internet Service API) server extension is a program that runs in

response to a GET or POST request from a client program(browser).


143.What is Multi threading?

It is the ability for a program to multitask within itself. The program can split

itself in to separate \"threads\" of execution that also seem to run concurrently.

144.Write the MFC WinInet Classes.

CInternetSession, CHttpConnection, CFtpConnection, CGopherConnection.

145.Write the MFC ODBC Classes.

CDatabase, CRecordSet, CRecordView.

146.Write the MFC DAO Classes.

CDaoDatabase, CDaoRecordSet, CDaoTableDef, CDaoQueryDef,

CDaoWorkspce, CDaoException, CDaoFieldExchange.

147. Differentiate NTFS from FAT.

NTFS

Network File System •

More Secured •

User Permission for individual files and folders •

Used with WinNT and above •

FAT
File Allocation Table •

Less Secured •

No individual user permissions •

Used with Win 95,98 •

148. What is Snapshot and Dynaset?

Snapshot is a RecordSet type. Snapshot downloads the entire query in one shot.

But occupy more memory to hold data. It has data as a static copy. When any changes

made to the database will not reflect to the current application.

Dynaset is a RecordSet type. In Dynaset only the records you actually need to fill

the screen will get downloaded. Constantly resynchronizes the recordset, so that any

changes will reflect immediately. Take less time to reflect.

16 Marks

1. What is a DBMS? What is an SQL? Explain MFC ODBC classes? Explain filter

& short strings?

2. I) Explain with example the Winsock class?

ii) Explain Threading?

3. Explain data access through ODBC with example?

Answer

i) Database creation

ii) Open VC++

iii) Connect database with VC++ through ODBC.


4. Write a VC++ program for chat application.

5. Write a VC++ program for playing an

i) Audio file

ii) Video file

You might also like