Visual C++

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

VISUAL C++ PROGRAMMING-INTRODUCTION

1.Define AppWizard

Appwizard is a code generator used to create a working skeleton for the windows with
the features source code and features specified through dialog boxes.

2.What are the types of mapping modes?

- MM_HIMETRIC
- MM_ANISOTROPIC
- MM_ISOTROPIC

3.What is the use of setMap Mode command?

It is used to return the previous mapping mode and sets the mapping mode specified in
the parameter.

4.What is resole font?

The system font is the font that windows uses by default for text string like strings in titke
bars, menus and dialog boxes. The system font is a razor font which means that the characters
are defined as blocks of pixels.

5.What is the use of get system metrics function?

This function retrieves information about the size of various graphical item in windows
such as icons, occurs, title bars and scroll bars. This function is an important function for
achieving device independent graphical outline in the program.

6.What is system modal dialog?

The 16-bit versions of windows support a special kind of modal dialog called a system
modal dialog, which prevents the user from switching to another application

7. Mention some of the GDI derived classes?


- Cbitmap
- Cbrush
- Cfont
- Cpalette
- Cpen
- Crgn

8.What are dialog controls?


A dialog control contains a number of elements called controls. These includes Edit
controls, buttons ,list boxes ,static text, Etc.
9.Explain the display context classes CclientDC and CwindowDC?

Windows client area excludes the border, the caption bar,and the menu bar.If we
construct an object of class Cclient DC,the point (0,0) is at the upper-left corner of the client
area.

10.What is the state of the device context?

The current state of the device context includes the following:


Attached GDI drawing objects such as pens,brushes and fonts.
The mapping mode that determines the scale of items when they are drawn.

11.What are GDI objects?

A window GDI object type is represented by an MFC library class.CGD iobject is the
abstract base class for the GDI object classes.

12.What is Project?

Project is a collection of interrelated source files that are compiled and linked to make up
an executable windows based program or a DLL.

13.What is Make File?

A make file stores compiler and linker options and express all the interrelationships
among source files.

14.What is a make program?

A make program reads the make files and then invokes a compiler , assembler, resource
compiler and linker to produce the final output, which is generally an executable file.

15.What is Class Wizard?

Class Wizard is a program that’s accessible from visual C++’s view menu.
Class wizard writes the prototypes,the function bodies and the code to link the windows message
to the function.

16.What is an application framework?

Application framework is an integraterd collection of object oriented software


copmponents that offers all that’s needed for a generic application.
17.Mention the two building options ?

- Win32 Debug
- Win32 Release

18.Mention the two types of fonts.

Two types of fonts are


- Device-independent fonts
- Device-dependent fonts.

19.List the types of video cards used to display the colors

- 256 color video card


- 16 bit color video card
- 24 bit color video card

20.Give the unique features of 24-bit color video cards:

High –end cards support 24-bit color .this 24-bit capability enables the display of more than
16.7 million pure colors.The RGB macro allows you to specify the exact colors you want.

Q2: How do I get the "old" (version 6) Visual C++ look in the new Visual Studio .NET environment?

A2: Click the My Profile link on the Start Page. Under Profile, click to select Visual C++ Developer from
the drop-down list box. Under Window Layout, click to select Visual C++ 6. This process will provide you
with the Visual C++ 6.0 appearance in the Visual Studio .NET environment

 What the basic controls in Visual C++ are


 How to declare and attach variables to a controls
 How to synchronize the values between a control and a variable
 How to specify the order users navigate around your application windows
 How to trigger actions with controls
 How to manipulate and alter the appearance of controls (while your application is
running)

Visual C++ Questions and Answers:


1 :: Why Array Index starts from Zero?
This boils down to the concept of Binary digits. Take an array size of 64 for example. We start from 0 and
end at 63. We require 6 bits.But, if we were to start from 1 and end at 64, we would require 7 bits to
store the same number, thus increasing the storage size.

2 :: How can server communicate with more than one client?


Server can communicate with more than one client with using threading concepts there are java threads
which are allocated to every client
when he logs in to server,the thread handles the client.

3 :: What is command routing in VC++?


in SDI:
View -> Doc -> FrameWnd -> App.

In MDI:
View->CDocument->CMDIChildWnd ->CMDIFrameWnd -> CWinApp.

4 :: How to change the Text of a CButton at Runtime?


CButton *btnsample= (CButton *)GetDlgItem(IDC_BUTTON1); //suppose IDC_BUTTON1 is the ID of
CButton
btnsample->SetWindowText(_T("Lahore"));

5 :: How to load an Icon on a CButton at Runtime?


CButton *btnsample = (CButton *)GetDlgItem(IDC_BUTTON1);
btnsample->ModifyStyle(0,BS_ICON,SWP_FRAMECHANGED); //change the style of CButton
HICON hIcon = ::LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_ICON)); //load an Icon
assuming IDI_ICON is ID of ICON
btnsample->SetIcon(hIcon);

6 :: How to Enable and Disable CButton at runtime?


CButton *btnsample = (CButton *)GetDlgItem(IDC_BUTTON1);
btnsample->EnableWindow(FALSE); // To Disable a button
btnsample->EnableWindow(TRUE); //To Enable a Button

7 :: How to change the Size of CButton at Runtime?


CButton *btnsample = (CButton *)GetDlgItem(IDC_BUTTON1);///suppose IDC_BUTTON1 is the ID of
CButton/
btnsample->SetWindowPos(0,0,0,100,100,SWP_FRAMECHANGED);

8 :: How to change the position of Button at runtime?


Assuming that you have set the button's ID as IDC_BTNSAMPLE in the resource editor :-
CButton *pBtnSample = (CButton *)GetDlgItem(IDC_BTNSAMPLE);
pBtnSample->SetWindowPos(0,0,0,100,100,SWP_FRAMECHANGED);
9 :: How to change the Properties of a Button at runtime?
Assuming that you have set the button's ID as IDC_BTNSAMPLE in the resource editor :-
We have to use the ModifyStyle Function to do this. The function is defined as follows :-
CButton *pBtnSample = (CButton *)GetDlgItem(IDC_BTNSAMPLE); // Make the button look like a
checkbox
pBtnSample->ModifyStyle(0,BS_AUTOCHECKBOX,SWP_FRAMECHANGED); // Remove the checkbox style
and make it again normal
pBtnSample->ModifyStyle(BS_AUTOCHECKBOX,0,SWP_FRAMECHANGED);

10 :: How to change the Mouse Pointer Over a Button at runtime?


Assuming that you have set the button's ID as IDC_BTNSAMPLE in the resource editor :-
// You have to handle the WM_SETCURSOR message handler to do that
BOOL CTestDlg::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
if (pWnd == GetDlgItem(IDC_BTNSAMPLE))
{ // To load a standard cursor
::SetCursor(AfxGetApp()->LoadStandardCursor(IDC_CROSS));
// To load your own custom cursor. Assuming that you have created a
// Cursor in the resource editor and named it as IDC_CURSAMPLE
::SetCursor(AfxGetApp()->LoadCursor(MAKEINTRESOURCE(IDC_CURSAMPLE)));
// Remember to return TRUE here return TRUE;
}
return CDialog::OnSetCursor(pWnd, nHitTest, message);
}

This set of C++ interview questions was sent to TechInterviews from Australia:

1. What is the difference between an ARRAY and a LIST?


2. What is faster : access the element in an ARRAY or in a LIST?
3. Define a constructor - what it is and how it might be called (2 methods).
4. Describe PRIVATE, PROTECTED and PUBLIC – the differences and give
examples.
5. What is a COPY CONSTRUCTOR and when is it called (this is a frequent question !)?
6. Explain term POLIMORPHISM and give an example using eg. SHAPE object: If I have
a base class SHAPE, how would I define DRAW methods for two objects CIRCLE and
SQUARE.
7. What is the word you will use when defining a function in base class to allow this
function to be a polimorphic function?
8. What are 2 ways of exporting a function from a DLL?
9. You have two pairs: new() and delete() and another pair : alloc() and free(). Explain
differences between eg. new() and malloc()
10. What is a callback function. Explain in C and C++ and WIN API environment.
11. (From WINDOWS API area): what is LPARAM and WPARAM?

VC++ Questions
1.How many types of DLLs are there?

2.What is different between Win32 DLL & COM DLL?

3.What is interface?

4.How u can know the functions of 3rd party Control?

5.What is MTS?

6.What is .LIB?

7.What is BASE CLASS of MFC?

You might also like