Vp Record Full

  • July 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Vp Record Full as PDF for free.

More details

  • Words: 3,513
  • Pages: 50
Instructions: 1)

When you write your record give the appropriate project names as follows

i)

For OnDraw program give the project name as Draw

ii)

forEvent handle – Eventhandle

iii)

for GDI – GDI

iv)b) Modaless dialogbox-Modaless vi) Document/View Architecture – Splitter viii)a)SDI Serialization – Sdiserial b) MDI Serialization – Mdiserial 2) Write your algorithms in a clear manner.

1. Program using application wizard: SDI, MDI, Drawing inside the view window, Device Context.(eg.Project name:dr) OnDraw(): This function is called to draw the document’s data in the window. STEPS INVOLVED: Step 1: Start Visual Studio. Step 2: Click File menu and select the New Project sub menu. Step 3: Select the project types as VC++ and select MFC ->MFC Application. Step 4: Name the project , change the location(if needed) and Click OK. Step 5: A welcome to MFC Application Wizard window appears, click next. Step 6: From the Application Type Window, select the application type as Single document or Multiple document and select other options, Click next. Step 7: Click next to move to consecutive windows and Click Finish. Step 8: From the Solution Explorer on the left-hand side of the workspace, double click the project name to select the files. E.g.: Project name: dr

Step 9: From the Solution Explorer, Select the Header Files folder & Select the drDoc.h and enter the following member variable, Public: CString str; Step 10: From the Source File folder, click the drDoc.cpp file and enter the following code,

BOOL CdrDoc::OnNewDocument() { if (!CDocument::OnNewDocument()) return FALSE; str="hello"; return TRUE; } Step 11: From the source file folder, double click the drView.cpp file to edit the OnDraw() function with the following code, void CdrView::OnDraw(CDC *pDC) Context. { pDC->Ellipse(25,25,200,100); ellipse.

// DC stands for Device

// This function is used to draw an

pDC->SetTextColor(RGB(255,0,0)); assign the text color.

// This function is used to

pDC->TextOut(90,70,pDoc->str); display the text.

// This function is used to

} Step10: Click Save All and execute the application.

Output:

2. Program to handle basic events: The message map, saving the view’s state, initializing a view class data member.(eg.Project name: EvView) Event handle: The event produced by a keystroke or a mouse click is processed using the application, it is termed as Event Handling. STEPS INVOLVED: Step 1: Start Visual Studio. Step 2: Click File menu and select the New Project sub menu. Step 3: Select the project types as VC++ , and select MFC ->MFC Application. Step 4: Name the project , change the location(if needed) and Click OK. Step 5: A welcome to MFC Application Wizard window appears, click next.

Step 6: From the Application Type Window, select the application type as either Single document or Multiple document and select other options, Click next. Step 7: Click next to move to consecutive windows and Click Finish. Step 8: From the Solution Explorer on the left-hand side of the workspace, double click the project name.

Step 9: Double click the (project name)View.h file under Header file folder and enter the following member variables, int m_nColor;

// Variable.

Step 10: Initialize the member variables within the (project name)View.cpp file under the source file folder using the following code, CEvView::CEvView() // member function is defined. { m_nColor=GRAY_BRUSH; } Step 11: From the Object Browser, select the project name, choose the view file & from the properties window, Click the messages icon to add OnLButtonDown event into

(project name)View.cpp void CEvView::OnLButtonDown(UINT nFlags, CPoint point) // Member function representing the left mouse button click event. { if(m_nColor==GRAY_BRUSH) the variable.

// Gray brush is assigned to

{ m_nColor=WHITE_BRUSH;

// White brush is used.

} else m_nColor=GRAY_BRUSH; } Step 12: From the same file edit the OnDraw() function, with the following code,

void CEvView::OnDraw(CDC* pDC) area.

// Function to draw in the window

{ pDC->SelectStockObject(m_nColor); objects(brush is used). pDC->Ellipse(0,0,200,100);

// Function to use the GDI // Function to draw an ellipse.

} Step 13: Click Save All and execute, In the output, Keep the mouse pointer into the ellipse and click the left mouse button to observe the change of color.(The color of the ellipse changes from gray to white).

Output:

3. Program using graphical device interface objects. GDI: Graphical Device Interface, provides device independent graphics support. Pen & Brush are the GDI objects used in the following program. STEPS INVOLVED: Step 1: Start Visual Studio. Step 2: Click File menu and select the New Project sub menu. Step 3: Select the project types as VC++ and select General -> Empty Project. Step 4: Name the project.

Step 5: From the Solution Explorer, right click the Source files folder and click the New Item menu to create a C++ file. Step 6: Similarly, right click the Resource files folder and add a new menu resource. Create two menus namely, SHAPES and TOOLS. SHAPES -> RECT, CIRCLE, LINE TOOLS ->PEN ->THIN, THICK  SOLID, HATCH

Step 7: Add the following code into the C++ file. #include #include "resource.h" class myframe:public CFrameWnd { public: char shape; int width; char tag; myframe() { Create(0,"GDI",WS_OVERLAPPEDWINDOW,rectDefault,NULL,MAKEINTRES OURCE(IDR_MENU1)); shape='a'; width=1; tag='s'; } void rect() { shape='r'; Invalidate(); } void circle() { shape='c'; Invalidate(); } void line() { shape='l'; Invalidate(); } void thin() { width=2; } void thick() { width=2; } void solid() {

tag='s'; } void hatch() { tag='h'; } void OnPaint() { CPaintDC d(this); CPen *p; p=new CPen; p->CreatePen(PS_SOLID,width,RGB(0,0,255)); d.SelectObject(p); CBrush *b; b=new CBrush; if(tag=='s') b->CreateSolidBrush(RGB(255,0,0)); else if(tag=='h') b->CreateHatchBrush(HS_DIAGCROSS,RGB(0,0,255)); d.SelectObject(b); if(shape=='r') d.Rectangle(100,200,200,300); else if(shape=='c') d.Ellipse(100,200,200,300); else if(shape=='l') { d.MoveTo(10,100); d.LineTo(200,400); } } DECLARE_MESSAGE_MAP() }; BEGIN_MESSAGE_MAP(myframe,CFrameWnd) ON_COMMAND(ID_SHAPES_REC,rect) ON_COMMAND(ID_SHAPES_CIRCLE,circle) ON_COMMAND(ID_SHAPES_LINE,line) ON_COMMAND(ID_TOOLS_PEN_THIN,thin) ON_COMMAND(ID_TOOLS_PEN_THICK,thick) ON_COMMAND(ID_TOOLS_BRUSH_SOLID,solid) ON_COMMAND(ID_TOOLS_BRUSH_HATCH,hatch) ON_WM_PAINT() END_MESSAGE_MAP() class mywin:public CWinApp { public: BOOL InitInstance() { m_pMainWnd=new myframe(); m_pMainWnd->ShowWindow(m_nCmdShow); m_pMainWnd->UpdateWindow(); return TRUE;

} };mywin my; Step 8: Save All and Execute.

4a) Program using Modal Dialogbox Step 1: Start Visual Studio. Step 2: Click File menu and select the New Project sub menu. Step 3: Select the project types as VC++ , and select MFC ->MFC Application. Step 4: Name the project , change the location(if needed) and Click OK. Step 5: A welcome to MFC Application Wizard window appears, click next. Step 6: From the Application Type Window, select the application type as either Single document or Multiple document and select other options, Click next. Step 7: Click next to move to consecutive windows and Click Finish. Step 8: From the Solution Explorer on the left-hand side of the workspace, double click the project name and select the Resource files folder to add a Dialog Box resource.

Step 9: From the resource view window, Add a dialog box with the following controls,

Step 10: From the solution explorer, right click the source file folder, add a class and name it disp and set the base class to CDialog (Eg: disp ) disp.cpp & disp.h files will be created in the source files folder and header file folder.

Step11: Click the disp.h file and add the following code,

Below the enum(IDD_DIALOG1) CString Name; CString Dept; CString Bio; int Regno;

Step12: Click the disp.cpp file and include “disp.h” And add the code, within the constructor, Name=_T(“”); Regno=0; Bio=_T(“”); Dept=_T(“”);

And in the DoDataExchange() method, enter the following code,

DDX_Text(pDX, IDC_EDIT1, Name); DDX_Text(pDX,IDC_EDIT2, Regno); DDX_Text(pDX,IDC_EDIT3, Bio); DDX_CBString(pDX,IDC_COMBO1, Dept);

Step13: Choose View-> Object Browser-> Select the project name and from the properties window, select the messages icon & activate the WM_ONLBUTTONDOWN.(As done for Event handling program) void C(Projectname)View::OnLButtonDown(UINT nFlags, CPoint point) { CView::OnLButtonDown(nFlags, point); disp a; a.Name="KUMAR"; a.Regno="101"; a.Bio="STUDENT"; a.Dept="MCA"; int r=a.DoModal(); TRACE("%d",r); }

Step14: Now click the (projectname)Doc.h file, within the Public access specifier, include, CString str;

Step15: Click the (projectname)Doc.cpp, within NewDocument() method, enter

Str=”Press the Left Mouse Button”;

Step16: Select the (projectname)View.cpp, within the OnDraw() method, enter

pDC->TextOut(50,50,pDoc->str);

Step17: Click Save All and Execute

4. b) Modaless Dialogbox Modaless Dialog Box: It behaves like a conventional window, it can be reactivated even while the dialog box is being displayed. (E.g. Find and Replace window in word document). STEPS INVOLVED:

Step 1: Start Visual Studio. Step 2: Click File menu and select the New Project sub menu. Step 3: Select the project types as VC++ and select General -> Empty Project. Step 4: Name the project.

Step 5: From the Solution Explorer, right click the Source files folder and click the New Item menu to create a C++ file. Step 6: Similarly, right click the Resource files folder and add a new dialogbox resource with the following controls,

Step 7:

Click IDC_BUTTON1 name it as COLOR Click IDC_BUTTON2 name it as FONT Click IDC_BUTTON3 name it as FILE

Step 8: Click the (project name).cpp file from the solution explorer and enter the following codes, #include #include #include "resource.h" class mydialog:public CDialog { public: mydialog():CDialog(IDD_DIALOG1) { } void OnOk() { EndDialog(TRUE); } void OnCancel() { EndDialog(TRUE); } void color() { CColorDialog a; if(a.DoModal ()==IDOK) { CClientDC dc(this); dc.SetTextColor(a.GetColor()); dc.TextOut (10,10,"Hello",5); } } void save_open() { char *str = "AllFiles(*.*)|*.*|CFile(*.c)"; CFileDialog d(false,NULL, "*.*",0,str); if(d.DoModal ()==IDOK) { CString str; str = "fileSave in:"+d.GetPathName (); d.GetPathName (); MessageBox(str,"Location"); } } void font() { LOGFONT lf; CFontDialog fd(&lf); if(fd.DoModal()==IDOK) { CFont f; f.CreateFontIndirect(&lf); CClientDC d(this);

d.SelectObject(&f); d.SetTextColor(fd.GetColor()); d.TextOut(10,10,"hello",5); } } DECLARE_MESSAGE_MAP() }; class myframe:public CFrameWnd { public: mydialog *d1; myframe() { d1=new mydialog(); d1->DoModal(); } }; BEGIN_MESSAGE_MAP(mydialog,CDialog) ON_BN_CLICKED(IDC_BUTTON1,color) ON_BN_CLICKED(IDC_BUTTON2,font) ON_BN_CLICKED(IDC_BUTTON3,save_open) END_MESSAGE_MAP() class mywin:public CWinApp { public: BOOL InitInstance() { m_pMainWnd=new myframe(); m_pMainWnd->ShowWindow(4); m_pMainWnd->UpdateWindow(); return TRUE; } }; mywin a; Step 9: Save All and Execute.

Output:

5a) Program using static controls

Step 1: Start Visual Studio. Step 2: Click File menu and select the New Project sub menu. Step 3: Select the project types as Visual Basic , and select Windows ->Windows Application. Step 4: Name the project , change the location(if needed) and Click OK. Step 5: Draw a Text Box on the form, and set the multiline property to True. Step 6: Add two buttons below the Text Box and customize the following properties,

Object

Property

Setting

TextBox1

ScrollBars

Vertical

Button1

Text

“Enter Temperatures”

Button2

Text

Form1

“Display Temperatures” Text

“Fixed Array Temperature”

Step 7: Right click the Form1.vb and select View code to enter the following line of code, Dim Temperatures(0 To 6) As Single Step 8: Double click the “Enter the Temperatures” button and enter the following code, Dim Prompt, Title As String Dim i As Short Prompt = "Enter the day's high temperature." For i = 0 To UBound(Temperatures) Title = "Day " & (i + 1) Temperatures(i) = InputBox(Prompt, Title) Step 9: Doble click the “Display Temperatures” button and add the following code, Dim Result As String Dim i As Short Dim Total As Single = 0 Result = "High Temperatures for the week: " & vbCrLf & vbCrLf For i = 0 To UBound(Temperatures) Result = Result * "Day " &(i + 1) & vbTab & _ Temperatures(i) & vbCrlf Total = Total + Temperatures(i) Next Result = Result & vbCrlf & _"Average temperature: " & Format(Total / 7,"0.0") TextBox1.Text = Result Step 10: Click Save all and execute.

5b) Program using Dynamic Control(Tree View Control)

Step 1: Start Visual Studio. Step 2: Click File menu and select the New Project sub menu. Step 3: Select the project types as VC++ and select General -> Empty Project. Step 4: Name the project and click OK. Step 5: From the solution explorer, right click the source file folder and create a new C++ file. Step 6: Click the C++ file and add the following code, #include #include

class myframe:public CFrameWnd { private: CTreeCtrl tree; public: myframe() { Create(0,"tree view control"); } int OnCreate(LPCREATESTRUCT l) { HTREEITEM lang,os,c,cpp,java; tree.Create(WS_VISIBLE|TVS_LINESATROOT| TVS_HASBUTTONS|TVS_SHOWSELALWAYS, CRect(30,30,300,350),this,1); lang=tree.InsertItem("Proglang",TVI_ROOT,TVI_SORT); c=tree.InsertItem("c",lang,TVI_SORT); tree.InsertItem("tc",c); tree.InsertItem("qc",c); cpp=tree.InsertItem("c++",lang,TVI_SORT); tree.InsertItem("vc++",cpp); tree.InsertItem("borland c++",cpp); java=tree.InsertItem("java",lang,TVI_SORT); tree.InsertItem("vj++",java); tree.InsertItem("sunjava",java); os=tree.InsertItem("os",TVI_ROOT,TVI_SORT);

tree.InsertItem("XP",os); tree.InsertItem("Fedora",os); return 1; } int OnNotify(WPARAM w,LPARAM l,LRESULT l1) { HTREEITEM h; CString str; NM_TREEVIEW *p=(NM_TREEVIEW *)l; if(p->hdr.code==TVN_SELCHANGED) { h=tree.GetSelectedItem(); str=tree.GetItemText(h); MessageBox(str,"selection"); } return 1; } DECLARE_MESSAGE_MAP() }; BEGIN_MESSAGE_MAP(myframe,CFrameWnd) ON_WM_CREATE() END_MESSAGE_MAP() class mywin:public CWinApp { public: BOOL InitInstance()

{ myframe *my; my=new myframe; my->ShowWindow(3); m_pMainWnd=my; return TRUE; } }; mywin a; Step 7: Click Save all and Execute. Output:

6. Program using Document/View Architecture [Splitter Window] Step 1: Start Visual Studio. Step 2: Click File menu and select the New Project sub menu. Step 3: Select the project types as VC++ , and select MFC ->MFC Application. Step 4: Name the project (eg. Splitt), change the location(if needed) and Click OK.

Step 5: A welcome to MFC Application Wizard window appears, click next. Step 6: From the Application Type Window, select the application type as Single document & Click next. Step 7: Click next to move to consecutive windows and in User Interface Features window, select the split window checkbox.

Step 8: In the Advanced Features window, deselect the Printing and Print Preview option and click next until Finish.

Step 9: From the solution Explorer, Select the Header Files folder & Select the splittDoc.h and enter the following member variable, Public: CString str;

Step 10: From the Source File folder, click the splittDoc.cpp file and enter the following code,

BOOL CSplittDoc::OnNewDocument() {

if (!CDocument::OnNewDocument()) return FALSE; str="Splitter Window"; return TRUE; }

Step 11: From the source file folder, click the splittview.cpp file and enter the following code into the OnDraw() function,

void CSplittView::OnDraw(CDC* pDC) { CSplittDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); pDC->Ellipse(25,25,200,100); pDC->TextOut(50,50,pDoc->str); } Step 12: Click Save All and Build & Execute., In the output window, Goto View-> Split & use mouse to partition the window area.

Output:

7a). Program using Tool bar Steps Involved: Step 1: Start Visual Studio. Step 2: Click File menu and select the New Project sub menu. Step 3: Select the project types as Visual Basic and select Windows -> Windows Application. Step 4: Name the project and click OK. Step 5: Insert Picture Box controls in to Form1.vb from the Tool Box. Step 6: Click the Tool Strip control in the Tool box, to add it to Form1.vb

Step 7: Click over the Tool Strip control and a list down box appears in the Form1.vb, select the Button tools (add four buttons).

Step 8: Right click the button and select the Set Image option, import the image to be displayed as icon for the button should be selected and set the tooltip property to New, Zoom In, Zoom Out and Close.

Step 9: Add the appropriate images and create four buttons of following style,

Step 10: Double the first button and enter the following code,

PictureBox1.ImageLocation = InputBox("Enter the location of picture")

Step 11: Click the second button and enter the following code,

PictureBox1.Width = PictureBox1.Width + 10 PictureBox1.Height = PictureBox1.Height + 10

Step 12: Click the third button and enter the following code,

PictureBox1.Width = PictureBox1.Width -10 PictureBox1.Height = PictureBox1.Height – 10

Step 13: Click the fourth button and enter the following code,

End Step 14: Click Save all and execute.

7b) Program using status bar Steps Involved: Step 1: Start Visual Studio. Step 2: Click File menu and select the New Project sub menu. Step 3: Select the project types as Visual Basic and select Windows -> Windows Application. Step 4: Name the project and click OK. Step 5: Add a Status bar and Button in to the form from Tool Box & set the Text property of the button to “Caption”

Step 6: Right click the status bar and click the panel properties, add three panels using the add button,

Step 7: Enable the show panel property to True.

Step 8: Click the button, add the following code, StatusBarPanel1.Text = "Image Display"

Step 9: Click over the statusbar & add the following code, StatusBarPanel2.Text = DateString StatusBarPanel3.Text = TimeString Step 10: Save all and execute.

8 a). SDI SERIALIZATION Step 1: Start Visual Studio. Step 2: Click File menu and select the New Project sub menu. Step 3: Select the project types as VC++ and select General -> Empty Project.

Step 4: Name the project and click OK. Step 5: From the solution explorer, right click the source file folder and create a new C++ file. Step 6: Similarly, right click the Resource files folder and add a new menu resource.

Step 7: Click the C++ file and add the following code, #include #include #include "resource.h" class myeditview:public CEditView { DECLARE_DYNCREATE(myeditview) public: BOOL PreCreateWindow(CREATESTRUCT &cs) { BOOL bp=CEditView::PreCreateWindow(cs); cs.style&=~(WS_HSCROLL); return bp; } }; IMPLEMENT_DYNCREATE(myeditview,CEditView) class mydocument:public CDocument { DECLARE_SERIAL(mydocument) void Serialize(CArchive &ar) { myeditview *v; v=(myeditview *)m_viewList.GetHead(); v->SerializeRaw(ar); } int OnNewDocument() { CDocument::OnNewDocument(); if(!CDocument::OnNewDocument()) return 0; else return 1;

} void DeleteContents() { myeditview *x; if(m_viewList.GetCount()) { x=(myeditview *)m_viewList.GetHead(); x->SetWindowText(NULL); } } }; IMPLEMENT_SERIAL(mydocument,CDocument,0) class myapp:public CWinApp { BOOL InitInstance() { CSingleDocTemplate *d; CRuntimeClass *f, *doc,*view; doc=RUNTIME_CLASS(mydocument); f=RUNTIME_CLASS(CFrameWnd); view=RUNTIME_CLASS(myeditview); d=new CSingleDocTemplate(IDR_MENU1,doc,f,view); AddDocTemplate(d); OnFileNew(); return 1; } DECLARE_MESSAGE_MAP() }; BEGIN_MESSAGE_MAP(myapp,CWinApp) ON_COMMAND(ID_FILE_NEW,CWinApp::OnFileNew) ON_COMMAND(ID_FILE_OPEN,CWinApp::OnFileOpen) END_MESSAGE_MAP() myapp a;

Step 8: Click Save All and Execute. Output:

8 b). MDI SERIALIZATION Step 1: Start Visual Studio. Step 2: Click File menu and select the New Project sub menu. Step 3: Select the project types as VC++ and select General -> Empty Project. Step 4: Name the project and click OK. Step 5: From the solution explorer, right click the source file folder and create a new C++ file. Step 6: Similarly, right click the Resource files folder and add a new menu resource.

Step 7: Click the C++ file and add the following code,

#include #include #include "resource.h" class myeditview:public CEditView { DECLARE_DYNCREATE(myeditview) public: BOOL PreCreateWindow(CREATESTRUCT &cs) { BOOL bp=CEditView::PreCreateWindow(cs); cs.style&=~(WS_HSCROLL); return bp; } }; IMPLEMENT_DYNCREATE(myeditview,CEditView) class mydocument:public CDocument { DECLARE_SERIAL(mydocument) void Serialize(CArchive &ar) { myeditview *v; v=(myeditview *)m_viewList.GetHead(); v->SerializeRaw(ar); } int OnNewDocument() { CDocument::OnNewDocument(); if(!CDocument::OnNewDocument()) return 0; else return 1; } void DeleteContents() { myeditview *x; if(m_viewList.GetCount()) { x=(myeditview *)m_viewList.GetHead(); x->SetWindowText(NULL); } } }; IMPLEMENT_SERIAL(mydocument,CDocument,0)

class myapp:public CWinApp { BOOL InitInstance() { CMultiDocTemplate *mdi; CRuntimeClass *f, *doc,*view; doc=RUNTIME_CLASS(mydocument); f=RUNTIME_CLASS(CMDIChildWnd); view=RUNTIME_CLASS(myeditview); mdi=new CMultiDocTemplate(IDR_MENU1,doc,f,view); AddDocTemplate(mdi); CMDIFrameWnd *ff; ff=new CMDIFrameWnd; ff->LoadFrame(IDR_MENU1); ff->ShowWindow(3); m_pMainWnd=ff; OnFileNew(); return 1; } DECLARE_MESSAGE_MAP() }; BEGIN_MESSAGE_MAP(myapp,CWinApp) ON_COMMAND(ID_FILE_NEW,CWinApp::OnFileNew) ON_COMMAND(ID_FILE_OPEN,CWinApp::OnFileOpen) END_MESSAGE_MAP() myapp a;

Step 8: Click Save All and Execute. Output:

9)Program to create dynamic link libraries using MFC

Step 1: Start Visual Studio. Step 2: Click File menu and select the New Project sub menu. Step 3: Select the project types as VC++ , and select MFC ->MFC DLL. Step 4: Name the project (eg.Regular), change the location(if needed) and Click OK. Step 5: A welcome to MFC Application Wizard window appears, click next. Step 6: In the application settings window, select the Regular DLL with shared MFC DLL. Step 7:Right click the solution explorer and add a C++ file, font.cpp & add the following code, #include "stdafx.h" _declspec(dllexport)void display(CDC *p,CString name,int size,COLORREF c,CPoint pt,CString text) { int ht=-((p->GetDeviceCaps(LOGPIXELSY)*size)/72); CFont myfont; myfont.CreateFont(ht,0,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,O

UT_CHARACTER_PRECIS,CLIP_CHARACTER_PRECIS,DEFAULT_QUALITY ,DEFAULT_PITCH|FF_DONTCARE,name); CFont*pfont=p->SelectObject(&myfont); p->SetTextColor(c); p->SetBkMode(TRANSPARENT); p->TextOut(pt.x,pt.y,text); p->SelectObject(pfont); } Step 8: Right click the header file folder, add a header file and add the following code, _declspec(dllimport)void display(CDC *p,CString name,int size,COLORREF c,CPoint pt,CString text); Step 9: Add a new Win 32 project, from the File menu.

Step 10: Create a Win32 project, select Win32 project option,

Step 11: Select DLL and Empty project as you click next.

Step 12: From the source file folder, create a C++ file, client.cpp

#include #include "font.h" class myframe:public CFrameWnd { public: myframe() { Create(0,"Client"); } void OnLButtonDown(UINT f,CPoint pt)

{ CClientDC d(this); display(&d,"",72,RGB(255,0,255),pt,"INDIA"); } DECLARE_MESSAGE_MAP() }; BEGIN_MESSAGE_MAP(myframe,CFrameWnd) ON_WM_LBUTTONDOWN() END_MESSAGE_MAP() class mywin:CWinApp { virtual BOOL InitInstance() { m_pMainWnd=new myframe(); m_pMainWnd->ShowWindow(1); m_pMainWnd->UpdateWindow(); return TRUE; } }; mywin my; Step 13: Goto Regular (project )folder and select Debug-> copy dll file & object file paste it into client/Debug folder. Step 14: Copy font.h from (project) Regular folder and paste it into client folder. Step 15: Goto Project ->properties->Linker->Map File Name and set the path of the dll file in the client folder.

Step 16: Click Save all and execute.

Output:

10) Program to interface with Database Step 1: Start Visual Studio. Step 2: Click File menu and select the New Project sub menu. Step 3: Select the project types as Visual Basic , and select Windows ->Windows Application. Step 4: Name the project , change the location(if needed) and Click OK. Step 5: Create a Access Database named student.mdb(if it access 2007,save as .mdb format), with the fields ID, Student Name and Dept. Step 6: From the Data Menu, click the Add New Data Source Command.

Step 7: In the Data Source Configuration Wizard, click the New Connection button,

Step 8: Select the Database format and click Continue,

Step 9: From the Add connection window, Click the Browse button and select the path of the access file & click the Test Connection Button.

Step 10: A message box appears stating Test Connection Succeeded.

Step 11: Once again from the Data Connection Wizard, click the Connection String(+) sign and click Next

Step 12: Click Next, A message appears, click No. Step 13: Click the (+) next to the Tables node, Select the Table1 and field values Student Name and Dept & click Views and click Finish.

Step 14: Click the StudentDataset.xsd and click the View Designer icon at the top of properties window.

Step 15: Click the Student Name field value and press F4 & set the maxlength property to 50. Step 16: Click the ListBox next to ID field and select Text Box, drag the field over to the form. Step 17: Click Save all and execute.

Related Documents

Vp Record Full
July 2020 0
Full Mp Mc Record New
June 2020 1
2kyuu2003doc Vp
November 2019 13
Cenovnik Vp
August 2019 23
Record
June 2020 17