Solved

Read ini file to show on SDI screen

Posted on 2004-10-11
4
206 Views
Last Modified: 2013-11-20
I'm a newbie to VC++ and I'm having a problem with reading ini file then show it on SDI screen.
The ini file is divided into sections which I call "Slide". I want to read these Slides and then show each Slide on the SDI screen. Slides will follow each other with a left mouse click, means that after I select the file from the Open File dialog, the first Slide of the file will show up on the SDI, then I click on the left mouse button, the second Slide will show up to replace the first Slide and so on...
I read the file OK, but having problem to show each Slide after left mouse click.
I think I must use OnDraw and Invalidate() but I still don't know how to use them.

I will really appreciate the sample code with comments for my problem
Thanks

The sample ini file :

[Slide 1]
text1=This is the 1st line
text2=This is the 2nd line
text3=This is the 3rd line

[Slide 2]
text1=This is the 1st line
text2=This is the 2nd line
text3=This is the 3rd line
text4=This is the 4th line

[Slide 3]
text1=This is the 1st line

0
Comment
Question by:huy302
  • 2
4 Comments
 
LVL 6

Expert Comment

by:Amritpal Singh
ID: 12284168
is ur problem with reading files or with displaying them
0
 
LVL 6

Accepted Solution

by:
Amritpal Singh earned 100 total points
ID: 12284183
ok sorry ,i didn't read it properly
ur problem is with displaying them
u can use OnLButtonDown event

have ur slides saved in a string array

and each time OnLButtonDown event is triggered display the string at next position
 u can use  a global or static counter fro this
0
 
LVL 13

Expert Comment

by:SteH
ID: 12285658
You are partly right,
in OnDraw you display the current slide which can reside in a CString or CStringArray.

In OnLButtonDown you change the content of the string to be displayed with the text of the next slide. And next you invalidate the view. That way it gets repainted which implicitly calls OnDraw (). No need to call it on your side.
0
 

Author Comment

by:huy302
ID: 12296448
you was right, amrit 82, my problem was that I read the file, saved my strings in one class and then triggered the OnDraw() function in another class so I can't have my strings to display.
Using global variable I can solve this problem well
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Add content to output file 4 67
FizzBuzz challenge 9 82
scoreUp challenge 14 63
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 103
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question