Program-1 Introduction To Visual C++
Program-1 Introduction To Visual C++
VISUAL C++
Visual C++ is a collection of many tools, all wrapped into one dynamic, ready to
use package for windows programming.
1
(FOUR PARTS OF A VISUAL C++ PROGRAM)
2
Creating a new MFC Application
File → new → projects → select → MFC AppWizard (exe) →give a project name → OK.
3
PROGRAM 2
STEP 1:
STEP 2:
OUTPUT
4
PROGRAM 3
5
3: Click on the view class, find OnDraw() method and write the following code.
OUTPUT
6
PROGRAM 4
2: Initialize the empty string in constructor of the document class. Write code
shown in the snapshot
7
3: Reading Keystroke.
8
9
5. OPEN ON DRAW() METHOD OF VIEW CLASS AND WRITE THE CODE SHOWN
IN SNAPSHOT
OUTPUT
10
PROGRAM 5
STEPS:
11
5. Go to view class and write the code.
12
13
7. Start ClassWizard, connect OnChar() method to the WM_CHAR windows
message in the view.
14
11. Move the caret as the use type text in OnDraw() method.
OUTPUT
15
PROGRAM 6
WAP FOR A MENU EDITOR ADDING A MENU ITEM AND DISPLAYING THE
MESSAGE
CLICK ON THE RESOURCE VIEW THIS OPENS THE MENU’S PROGRAM RESOURCE
FOLDER.
CLICK ON THE PRINT PREVFIEW MENU ITEM MPRESS INSERT KEY, BLANK MENU ITEM APPEAR WRITE
CAPTION PRINT WELCOME AND CLOSE THE DIALOG BOX
16
STEP 3 CONNECTING MENU ITEM TO CODE
OBJECT ID ID_FILE_WELCOME
17
A DIALOG BOX APPEARS, CLICK OK
STEP 5
18
STEP 6
STEP 7 OPEN ONDRAW METHOD OF VIEW CLASS AND WRITE THE CODE
19
OUTPUT
20
PROGRAM 7
STEP 1
CLICK ON FILE -> NEW -> MFC APP.exe -> CHOOOSE DIALOG BASED ISTEAD OF SINGLE DOCEMUNT -
> FINISH
YOU WILL SEE A TOOL BOX AND A DESIGN WINDOW AS SHOWN IN SNAPSHOT
21
STEP 3: NOW ADD ACTIVEX CONTROL IN YOUR PORJECT
GOTO PROJECT -> ADD TO ACTIVE PROJECT -> COMPONENTS AND CONTROL -> OPEN REGISTERED
ACTIVEX COMPONENTS -> SELECT MICROSOFT WEB BROWSER FROM THE LIST -> INSERT ->
OK(CONFIRM THE CLASS)-> CLOSE
22
STEP 4: NOW DRAG THIS CONTROL ON YOUR DESIGN WINDOW AND DRAG A BUTTON
23
STEP 5: NOW CONNECT A MEMBER VARIABLE TO THIS CONTROL AND NAME THAT VARIABLE
m_browser
For this:
24
STEP 6: NOW CONNECT EVENT HANDLER METHOD TO THAT BUTTON
For this:
25
STEP 7: DOUBLE CLICK ON BUTTON AND WRITE THE CODE
m_browser>Navigate(http://www.gmail.com,0,0,0,0);
26
OUTPUT
27
PROGRAM 8
FORM
28
STEP 2: CODING THE BUTTON ACTIONS
num1 = Text1.text
num2 = Text2.text
Text3.text = num3
End Sub
num1 = Text1.text
num2 = Text2.text
Text3.text = num3
End Sub
29
num1 = Text1.text
num2 = Text2.text
Text3.text = num3
End Sub
num1 = Text1.text
num2 = Text2.text
Text3.text = num3
End Sub
30
OUTPUT
31