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

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())





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

m_pdata= new char[ncount];



delete [] m_pdata;



Posted Date: 10/10/2012 2:03:01 AM | Location : United States

Related Discussions:- Displaying the file without scrolling - document class, Assignment Help, Ask Question on Displaying the file without scrolling - document class, Get Answer, Expert's Help, Displaying the file without scrolling - document class Discussions

Write discussion on Displaying the file without scrolling - document class
Your posts are moderated
Related Questions
I have an assignment In HCI , can anyone help me ?

#questiontypes of lines and how to draw

i have a database i want mange it network and i want write it with vb.net so how i can do this

A program needs to be written that is capable of simple image processing. All the images that are available for you to use, can be found on Blackboard in the Assignments section. T

Data types: The New data types were defined by using the typedef or #define statements. This was to allow the transition from 16 bit to 32 bit system. Some of the fresh data t

Deleting Handlers With Class Wizard: The handler can be deleted by using the class wizard. The class wizard will delete the prototype and message map entry. The user should ma

In VBScript, You create user-defined constants using the Const statement. It lets you create string or numeric constants along with meaningful names and let you to assign them lite

Would it be possible to see an example of an array program that tracks rent in different apartment buildings and is modular?

Objective: To develop an Application (Excel + VBA) that determines the optimal inventory policy under an All-Units Discount scheme. APPLICATION CHARACTERISTICS Consider the

MESSAGE LOOP   The message loop is the code in the Win 32 based application. It retrieves messages from the application's message queue and passes these to the related window