View Single Post
Old 11th March 2008, 23:30   #20
Anders's Avatar
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,484
alright, I think this works
!define SF_RTF 2
!define EM_STREAMIN 1097
!define EM_EXLIMITTEXT 1077
Function lic
FileOpen $4 "test.rtf" r
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1000
SendMessage $0 ${EM_EXLIMITTEXT} 0 0x7fffffff
System::Get /NoUnload "(i, i .R0, i .R1, i .R2) iss"
Pop $2
System::Call /NoUnload "*(i 0, i 0, k r2) i .r3"
System::Call /NoUnload "user32::SendMessage(i r0, i ${EM_STREAMIN}, i ${SF_RTF}, i r3) i.s"
Pop $0
StrCmp $0 "callback1" 0 done
System::Call /NoUnload "kernel32::ReadFile(i $4, i $R0, i $R1, i $R2, i 0)"
Push 0 # callback's return value
System::Call /NoUnload "$2"
goto loop
System::Free $2
System::Free $3
FileClose $4

the code is a little bit longer than the WM_SETTEXT code, but it does not alloc the whole file at once, and does not know or care about the filesize at all

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote