Link to home
Start Free TrialLog in
Avatar of huy302
huy302

asked on

Read ini file to show on SDI screen

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

Avatar of Amritpal Singh
Amritpal Singh
Flag of India image

is ur problem with reading files or with displaying them
ASKER CERTIFIED SOLUTION
Avatar of Amritpal Singh
Amritpal Singh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Member_2_1001466
Member_2_1001466

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.
Avatar of huy302

ASKER

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