| RTFEditHwnd | Handle to the new control |
| Style | See AHK documentation for edit control styles |
| Edit2HWnd | Handle to an existing edit control. This one gets replaced by the RTF edit control |
| nScroll | 0: no horizontal scrolling 1: horizontal scrolling |
| nRC | Error: 0 ok: 1 |
| RTFEditHwnd | Handle to the RTF edit control. |
| nMode | 0: Ruler is in inches - 1: Ruler is in metrics |
| fToolbar | 0: Hide Toolbar - 1: Show Toolbar |
| fRiler | 0: Hide Ruler - 1: Show Ruler |
| nRC | Error: 0 ok: 1 |
| RTFEditHwnd | Handle to the RTF edit control. |
| RTFFileName | Filename to open. If you specify an empty string, a file open dialog is displayed |
| int 254 | Length of the string. Use i.e. VarSetCapacity(xxx,200) to reserve enough space |
| nRC | Error: 0 ok: 1 |
| RTFEditHwnd | Handle to the RTF edit control. |
| RTFFileName | Filename to save. If you specify an empty string, a file save dialog is displayed |
| int 254 | Length of the string. Use i.e. VarSetCapacity(xxx,200) to reserve enough space |
| nRC | Error: 0 ok: 1 If called with nSize = 0 you retrieve the length of the text |
| RTFEditHwnd | Handle to the RTF edit control. |
| szText | Variable to retrieve the RTF-content |
| int nSize | You must reserve enough space to retrieve the full text. Use VarSetCapacity(szText,5000) It's hard to guess the correct length. So you better call this function with "0" as nSize. Then you can retrieve the needed length in the nRC return value. See the example below |
| nRC | Error: 0 ok: 1 If called with nSize = 0 you retrieve the length of the text |
| RTFEditHwnd | Handle to the RTF edit control. |
| nModifier | 0= no modifier, 1=ALT-key pressed |
| nKey | You can retrieve the key with that code:OnMessage(0x0102, "CHARMsg") OnMessage(0x0106, "CHARMsg") |
| nFunction |
|
| nParameter | Depends on nFunction eFind: 0:Find, 1:Replace eToolbarShowHideToolbar: 1:Show Toolbar, 0:Hide Toolbar, 2:Toggle Toolbar eToolbarShowHideRuler: 1:Show Ruler, 0:Hide Ruler, 2:Toggle Ruler |
| nRC | Error: 0 ok: 1 If called with nSize = 0 you retrieve the length of the text |
| RTFEditHwnd | Handle to the RTF edit control. |
| LineCnt | Retrieves the count of lines if szLength == 0 Retrieves the amount of character copied into the buffer |
| szLine | Buffer. Line is copied into this var. Use i.e. VarSetCapacity(xxx,2000) to reserve enough space |
| nRC | Error: 0 ok: 1 If called with nSize = 0 you retrieve the length of the text |
| RTFEditHwnd | Handle to the RTF edit control. |
| nFunc |
|
; --------------- Create a RTF Edit ----------------------------------
; -----------------------------------------------------------------------
dwexStyle := 0x0
RTFEditHwnd := DllCall("AHKCtrlSupport\CreateRTFEditID", DWORD, dwexStyle, DWORD, Edit2HWnd, "Cdecl Int")
if (errorlevel <> 0) || (RTFEditHwnd = 0)
{
MsgBox error while calling CreateRTFEditID Errorlevel: %errorlevel% - RC: %RTFEditHwnd%
return
}
nMode = 0 ; 0 = inch, 1 = metric
fToolbar = 1
fRuler = 1
nRC := DllCall("AHKCtrlSupport\SetRTFEdit", DWORD, RTFEditHwnd, int, nMode, int, fToolbar, int, fRuler, "Cdecl Int")
if (errorlevel <> 0) || (nRC = 0)
{
MsgBox error while calling SetRTFEdit Errorlevel: %errorlevel% - RC: %RTFEditHwnd%
return
}
return
LoadRTF:
VarSetCapacity(RTFFileName, 255)
nRC := DllCall("AHKCtrlSupport\RTFEditLoad", DWORD, RTFEditHwnd, str, RTFFileName, int, 254, "Cdecl Int")
if (errorlevel <> 0) || (nRC = 0)
{
MsgBox error while calling RTFEditLoad Errorlevel: %errorlevel% - RC: %RTFEditHwnd%
return
}
return
SaveRTF:
VarSetCapacity(RTFFileName, 255)
nRC := DllCall("AHKCtrlSupport\RTFEditSave", DWORD, RTFEditHwnd, str, RTFFileName, int, 254, "Cdecl Int")
if (errorlevel <> 0) || (nRC = 0)
{
MsgBox error while calling RTFEditLoad Errorlevel: %errorlevel% - RC: %RTFEditHwnd%
return
}
return
GetRTF:
;Get the size of the String by setting nSize to 0
nSize = 0
nRC := DllCall("AHKCtrlSupport\GetRTFEditText", DWORD, RTFEditHwnd, str, szText, int, nSize, "Cdecl Int")
;nRC is the length of the text
nRC += 2 ;string terminates with zero. Include this in size
VarSetCapacity(szText ,nRC)
nSize := nRC
;ToolTip, %nSize%
nRC := DllCall("AHKCtrlSupport\GetRTFEditText", DWORD, RTFEditHwnd, str, szText, int, nSize, "Cdecl Int")
if (errorlevel <> 0) || (nRC = 0)
{
MsgBox error while calling GetRTFEditText Errorlevel: %errorlevel% - RC: %RTFEditHwnd%
return
}
MsgBox %szText%
return