Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change
Quote from: NoCforMe on November 25, 2024, 09:16:11 AMrelative speeds of writing text to a RichEdit control vs. an ordinary edit control
Quote from: jj2007 on November 25, 2024, 09:13:12 AMOK. Makes sense since the call to WriteFile() returns before the data is actually written to disk.Quote from: NoCforMe on November 25, 2024, 08:56:34 AMwriting to a file has got to be a lot slower than storing the text in a buffer
There is not much of a difference because you don't really write to a file; you just hand over the content to the OS, which transfers it physically to a drive whenever it finds the time to do so.
Quote from: NoCforMe on November 25, 2024, 08:56:34 AMwriting to a file has got to be a lot slower than storing the text in a buffer
Quote from: zedd151 on November 25, 2024, 09:00:11 AMYes, but it can't possibly be as fast as writing to a memory buffer, since it involves transfer to a physical device.Quote from: NoCforMe on November 25, 2024, 08:56:34 AMThe first part of that makes absolutely no sense: writing to a file has got to be a lot slower than storing the text in a buffer, which is what I'm already doing.My tests have shown that it can be very fast indeed to write to a file. But...
Quote from: NoCforMe on November 25, 2024, 08:56:34 AMThe first part of that makes absolutely no sense: writing to a file has got to be a lot slower than storing the text in a buffer, which is what I'm already doing.My tests have shown that it can be very fast indeed to write to a file. But...
QuoteHowever, the second part of your suggestion might work: basically substituting a RichEdit control for the lowly edit control. Will try that.Should be noticeably faster. Perhaps even much faster... than the simple edit control.
Quote from: zedd151 on November 25, 2024, 08:40:36 AMHow about first writing the data to a file, then load it into your edit window using a rich edit contol and 'stream' the data in.The first part of that makes absolutely no sense: writing to a file has got to be a lot slower than storing the text in a buffer, which is what I'm already doing.
Quote from: NoCforMe on November 25, 2024, 07:39:12 AMAnother option would be to write the text to a file, which I'm sure would also be faster than waiting on the edit control to fill up.I just tested a 15 MB file, opening with both notepad and qeditor. Both of them open the file very quickly. i.e., dont blink or you will miss it. How about first writing the data to a file, then load it into your edit window using a rich edit contol and 'stream' the data in.
ofCallBack proc dwCookie:DWORD,pbBuff:DWORD,cb:DWORD,pcb:DWORD
invoke ReadFile,dwCookie,pbBuff,cb,pcb,NULL
mov eax, 0
ret
ofCallBack endp
StreamFileIn proc hEdit:DWORD,lpszFileName:DWORD
LOCAL hFile :DWORD
LOCAL fSiz :DWORD
LOCAL ofs :OFSTRUCT
LOCAL est :EDITSTREAM
LOCAL buffer[32]:BYTE
LOCAL aval[8]:BYTE
invoke OpenFile,lpszFileName,ADDR ofs,OF_READ
mov hFile, eax
mov est.dwCookie, eax
mov est.dwError, 0
mov eax, offset ofCallBack
mov est.pfnCallback, eax
invoke SendMessage,hEdit,EM_STREAMIN,SF_TEXT,ADDR est
invoke GetFileSize,hFile,NULL
mov fSiz, eax
invoke CloseHandle,hFile
szText OpenMsg,"Opened at "
szText OpenByt," bytes"
mov buffer[0], 0
invoke szCatStr,ADDR buffer,ADDR OpenMsg
invoke dwtoa,fSiz,ADDR aval
invoke szCatStr,ADDR buffer,ADDR aval
invoke szCatStr,ADDR buffer,ADDR OpenByt
invoke SendMessage,hStatus,SB_SETTEXT,3,ADDR buffer
invoke SendMessage,hEdit,EM_SETMODIFY,0,0
mov eax, 0
ret
StreamFileIn endp
INVOKE ShowWindow, ResultsDispHandle, SW_HIDE
but for some reason that didn't work at all.