Dear people,
How do I get FINDTEXT structure working?
I have no idea how to declare it with freebasic.
#include Once "Afx/AfxRichEdit.inc"
#include Once "win/richedit.bi"
Function frmMain_Button1_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
? RichEdit_FindText( frmMain.RichEdit1.hWindow, FR_WHOLEWORD,
Function = 0
End Function
''' ========================================================================================
''' Finds text within a rich edit control.
''' ========================================================================================
''PRIVATE FUNCTION RichEdit_FindText (BYVAL hRichEdit AS HWND, BYVAL fOptions AS DWORD, BYVAL lpft AS FINDTEXTW PTR) AS LONG
'' FUNCTION = SendMessageW(hRichEdit, EM_FINDTEXTW, fOptions, cast(LPARAM, lpft))
''END FUNCTION
''' ========================================================================================
Thanks in advance for your help
DIM ftw AS FINDTEXTW
ftw.chrg.cpMin = 0
ftw.chrg.CpMax = -1
DIM wszText AS WSTRING * 260 = "<text to find>"
ftw.lpstrText = VARPTR(wszText)
? RichEdit_FindText(frmMain.RichEdit1.hWindow, FR_WHOLEWORD, @ftw)
FINDTEXTEXW structure
See: https://docs.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-findtextexw
CHARRANGE structure
See: https://docs.microsoft.com/en-us/windows/win32/api/richedit/ns-richedit-charrange
A small change to the code so that we leave a working example.
I forgot FR_DOWN message.
Function frmMain_Button2_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
DIM ftw AS FINDTEXTW
ftw.chrg.cpMin = 0
ftw.chrg.CpMax = -1
DIM wszText AS WSTRING * 260 = "<text to find>"
ftw.lpstrText = VARPTR(wszText)
? RichEdit_FindText(frmMain.RichEdit1.hWindow, FR_DOWN or FR_WHOLEWORD, @ftw)
Function = 0
End Function
hello jermy ... so how does that richedit findtext code work ? its got me curious....