hello. How I can send text to an rich edit control?
I have got an error Type mismatch at parameter 1.. SendMessageW()
I wanted to update my code example from afx to afxnova ;)
thanks, frank
#define UNICODE
'#define _CREC_DEBUG_ 1
#include once "AfxNova/CWindow.inc"
#include once "AfxNova/CRichEditCtx.inc"
' #include once "AfxNova/CRichEditOleCallback.inc"
USING AfxNova
...
' // Add a rich edit control2
DIM pRichEdit2 AS CRichEditCtx = CRichEditCtx(@pWindow, IDC_RICHEDIT2, "edit2", 10, 10, _
pWindow.ClientWidth - 460, pWindow.ClientHeight - 160, -1, 0)
''WS_VISIBLE OR WS_TABSTOP OR ES_LEFT OR WS_VSCROLL OR ES_MULTILINE OR ES_WANTRETURN OR ES_NOHIDESEL OR ES_SAVESEL)
' // Fill the control with some data
DIM dwsText AS DWSTRING
dwsText="Hello2 Editor"
SendMessageW ( pRichEdit2, WM_SETTEXT, IDC_RICHEDIT2 , strptr(dwsText) )
' // Change the default font
'pRichEdit.SetFont("Times New Roman", 12)
SetFocus pRichEdit.hRichEdit
If you inisist in using SendMessageW, you need to use
SendMessageW(pRichEdit2.hRichEdit, WM_SETTEXT, 0, CAST(LPARAM, STRPTR(dwsText)))
But you can use
pRichEdit2.SetText(dwsText)
or
pRichEdit2.Text = dwsText