| |
|
|
|
Source watts on the 15.07.2007 from the MMJ-Quellcodesammlung (Dietmar horn) in The Babyklappe on XProfan.Com stored:
Listbox: Textdatei (To 32 KB) in a Listbox reading
PRFellow-Presentation
Author: Thomas Hölzer
Textdatei (To 32 KB) in a ListBox reading
Parameter: 1 = lever the ListBox, 2 = Dateiname, 3 = Löschflag
If Parameter 3 <> 0, becomes the ListBox-Content always first deleted
Def LockWindowUpdate(1) !USER32,LockWindowUpdate
Declare buf#
Proc AddTextFileToListBox
Parameters liste&,file$,reset%
Declare tempedit&,size&,anzahlzeilen%,i%
FindFirst$(file$)
Case %IOResult: Return 0
Case reset%: SendMessage(liste&,$0184,0,0) ListBox apiece to option clear
Let tempedit&=CreateMultiEdit(GetActiveWindow(),,0,0,0,1)
FileMode 0
Assign #1,file$
OpenRW #1
Let size&=GetFileSize(#1)
Dim buf#,Add(size&,1)
BlockRead(#1,buf#,0,size&) Dateiinhalt ... Read
CloseRW #1
SendMessage(tempedit&,$0C,0,buf#) ... and in temp. Edit write
Let anzahlzeilen%=SendMessage(tempedit&,$0BA,0,0)
Dispose buf#
LockWindowUpdate(liste&) sees for manchen savour something rather from
While Lt(i%,anzahlzeilen%)
AddStrings(liste&,GetLine$(tempedit&,i%))
Inc i%
Wend
LockWindowUpdate(0) not forget!
DestroyWindow(tempedit&) temp. Edit enable
Return 1
ENDPROC
example
Declare listbox&
SetTrueColor 1
Cls RGB(192,192,192)
Window Title Add$(GetText$(%hwnd), - Powered by PRFellow 2001)
Let listbox&=CreateListBox(%hwnd,,110,20,400,400)
AddTextFileToListBox listbox&,Add$($WinPath,WIN.INI),1
While 1
WaitInput
Wend
|
|
|
| |
|
|