03-30-2018, 02:23 AM
Thanks Gintaras,
I tried as below but still crashes WordPad. Any thoughts? Thanks! S
Function RichEditRtfString
I tried as below but still crashes WordPad. Any thoughts? Thanks! S
Function RichEditRtfString
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 RichEdit20A 0x54233044 0x200 8 8 208 104 ""
;4 Button 0x54032000 0x0 8 116 48 14 "Test"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""
str controls = "3"
str re3
if(!ShowDialog("RichEditRtfString" &RichEditRtfString &controls)) ret
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 4 goto gTest
ret 1
;gTest
str rtf = "{\rtf1 \ansi \deff0 {\fonttbl {\f0 Monotype Corsiva;}} \qc \f0 \fs120 \i \b Hello,\line World!}"
int w=win("Document - WordPad" "WordPadClass")
int c= id(59648 w) ;;editable text 'Rich Text Window'
__ProcessMemory m.Alloc(c 1000)
m.WriteStr(rtf sizeof(rtf))
SETTEXTEX t
SendMessageW(c EM_SETTEXTEX &t m.address)