flat assembler
Message board for the users of flat assembler.

Index > Windows > Display Part of a file in a RichEdit?

Author
Thread Post new topic Reply to topic
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 03 Mar 2012, 12:34
Is there a way to dispay a disired part of a file in RichEdit control.
for example ,
from a "===============================" part to next same like part in attached file. Confused


Description:
Download
Filename: test.txt
Filesize: 3.85 KB
Downloaded: 317 Time(s)

Post 03 Mar 2012, 12:34
View user's profile Send private message Send e-mail Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 03 Mar 2012, 15:52
here with code(attached with this),I could show whole txt file in a RichEdit controle.But now I want to show part of the txt file in Rich edit control.For that can I use same methode or Is there are way in winAPI.Please someone help Question


Description:
Download
Filename: tst.zip
Filesize: 5 KB
Downloaded: 284 Time(s)

Post 03 Mar 2012, 15:52
View user's profile Send private message Send e-mail Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 03 Mar 2012, 16:07
Very strange method of loading text in the RichEdit...
Why not to read the whole file into the memory and then to use WM_SETTEXT to set the control text.
Post 03 Mar 2012, 16:07
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 03 Mar 2012, 16:48
Post 03 Mar 2012, 16:48
View user's profile Send private message Send e-mail Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 03 Mar 2012, 16:49
According to Iczelion's Win32 Assembly tutorial
http://win32assembly.online.fr/tut33.html WM_SETTEXT methode may not be efficient if the file is large.It recommend EM_STREAMIN message.
Any way my problem is how to select desired part of the file and loading it to RichEdit.Please help??
Post 03 Mar 2012, 16:49
View user's profile Send private message Send e-mail Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 03 Mar 2012, 17:11
Well, WM_SETTEXT is not "a method", I hope you understand there is no object oriented programming in WinAPI.

At second, you must determine what part of the text you need - the offset of the begining and the end of the block you need.
So, now you have to put one 0 byte/word at the end of the text and pass the pointer of the begining to WM_SETTEXT.

Another option (if you insist on EM_STREAMIN) you can make the stream callback function to read only the part of the file you need. You can use the function SetFilePointer in order to begin the read from the middle of the text and simply to return 0 if the needed chunk was already read.
Post 03 Mar 2012, 17:11
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 03 Mar 2012, 17:18
thank you very much JohnFound.I'll try with SetFilePointer methode.
Post 03 Mar 2012, 17:18
View user's profile Send private message Send e-mail Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 517
Location: Munich
shutdownall 03 Mar 2012, 17:38
mns wrote:
According to Iczelion's Win32 Assembly tutorial
http://win32assembly.online.fr/tut33.html WM_SETTEXT methode may not be efficient if the file is large.

What was the date of this tutorial creation and what is large and what is fast ? Rolling Eyes

A modern PC can read up 1 GByte in memory with DDR3 RAM in less than one second (theoretical value). Modern SATA disks can read 150 MByte/s or more.
What WIN internally does is another thing but I would try first. And I never found text files with a few hundred mega bytes which have to be read or edited. Maybe some large logfiles but there are concepts to build them daily.

I would first try and not believe all what the tutorial says about large files. Whatever a large file is. Razz
Post 03 Mar 2012, 17:38
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.