Displaying the file without scrolling - document class, Visual Basic Programming

Assignment Help:

Displaying the file Without Scrolling:

To display a file follow the steps as shown below:

1. Generate a SDI application.

2. Type the coding as shown in the Serialize else part. The CArchive objects are used for writing or for retrieving the file.

3. Generate a global string m_pdata in the document class. To generate the global data click on the ClassView tabpage.

Enlarge the tree control of classes.

Select the CStoreDoc class.

Right click and choose the add member variable.

Specify the type as char and the variable name as *m_pdata

The GetFile() function of the CArchive is used for selecting the file to be displayed.

The GetLength() returns the size of the file.

4. Allocate the memory to the string m_pdata by using the new operator.

5. The Read function of CArchive stores the ncount characters of the file to be displayed in the string of m_pdata.

6. The string m_pdata is displayed by using AfxMessageBox.

7. The dynamically allocated memory is improved by using the delete function.

8. Construct and execute the project.

9. Choose a file and open the menu item.

10. Choose a file.

11. The contents will be displayed in the message box.

void CStoreDoc::Serialize(CArchive& ar)

{

if (ar.IsStoring())

{

}

else

{

unsigned int ncount = ar.GetFile()->GetLength();

m_pdata= new char[ncount];

ar.Read(m_pdata,ncount);

AfxMessageBox(m_pdata);

delete [] m_pdata;

}

}


Related Discussions:- Displaying the file without scrolling - document class

Mfc classes, THE MFC CLASSES The CDocument, CWinAppCFrameWnd and CView ...

THE MFC CLASSES The CDocument, CWinAppCFrameWnd and CView are derived from the CObject and they give the majority of the structure and functionality.

Software that is obscure - basics of gui design, Software That Is Obscure: ...

Software That Is Obscure: The Software hides the intensions, meaning and actions from the user. For illustration, if a user is asked whether a full installation, the custom in

If - else statement, A variation on the If...Then...Else statement lets you...

A variation on the If...Then...Else statement lets you to choose from various alternatives. By adding up Else If clauses expands the functionality of the If...Then...Else statement

Kitchen mock, How to pull ordered menu from a cash till to database or disp...

How to pull ordered menu from a cash till to database or display on a computer screen

Adding events in visual basic , Adding Events in VB   For adding the e...

Adding Events in VB   For adding the events in VB, first double click on the command button with the caption hello. The Private Sub command1_Click () and End Sub would be

Wage calculator and ta calculations, ( Wage Calculator with Tax Calculation...

( Wage Calculator with Tax Calculations) Develop an application that calculates an employee’s earnings, as shown in Fig. 4.23. The user should provide the hourly wage and number of

Programming, i have connected my visual basic 2010 express in ports and use...

i have connected my visual basic 2010 express in ports and use it to send sms but it failed... now my teacher said that i have to use my LAN not port to send it instead..... please

Input box - dialogue box in visual basic , Input Box: To demonstrate t...

Input Box: To demonstrate the use of the Input Box as shown in figure. Now consider the illustration shown below: 1. Initiate a new project 2. Select the standard exe

ADO.net architecture, write a detailed account on ADO.net architecture.

write a detailed account on ADO.net architecture.

Aim - control statement, Aim: To exhibit what is the day when the seco...

Aim: To exhibit what is the day when the second command button is clicked and to clear the screen when the first command button is clicked. The functioning of this program is

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd