corrupt- This is really awesome! This has been a highly anticipated gui control.. & I'm looking forward to it being fully implemented. I'm new to trying to make dllcalls.. but thanks to
PhiLho's help (
ApiViewer really helped w/ making it all
click!

) I managed to wrap up a couple new functions:
Quote:
EM_EXGETSEL - retrieves the starting and ending character positions of the selection in a RE control.
cGUI_RICHEDIT(ReHwnd, "EM_GETTEXTRANGE")
EM_SETFONTSIZE - The EM_SETFONTSIZE message sets the font size for the selected text.
cGUI_RICHEDIT(ReHwnd, "EM_SETFONTSIZE", -4) ; (changes font size from current state..)
(requires
ExtractInteger &
InsertInteger functions to be available as shown in '
Structures and Arrays')
Code:
/*
*****************************************************************************************
Add your own RICHEDIT features to the function below
Please submit additional features if you think that others may find
them useful so that I can update the current version posted
Much more to come soon...
*****************************************************************************************
*/
Else If _action = YourNewFeature
{
; Do something here
Return
} ;-----------------------------
Else If _action = EM_EXGETSEL
{
;-- The EM_EXGETSEL message retrieves the starting and ending character positions of the selection
VarSetCapacity(_tmp1, 8, 0) , InsertInteger(8, _tmp1, 4)
DllCall("SendMessage" ;// returns LRESULT in lResult
, "UInt" , _ctrlID ;// handle to destination control
, "UInt" , 0x434 ;// message ID (EM_EXGETSEL := WM_USER + 52)
, "UInt" , 0 ;// wParam - Parameter is not used; must be zero.
, "Cdecl UInt" , &_tmp1) ;// lParam - Pointer to CHARRANGE structure that receives the selection range
Return ExtractInteger(_tmp1, 0) . "|" . ExtractInteger(_tmp1, 4) ;// Return Value: returns CHARRANGE Structure (cpMin & cpMax)
} ;-----------------------------
Else If _action = EM_SETFONTSIZE
{
;-- The EM_SETFONTSIZE message sets the font size for the selected text.--
DllCall("SendMessage" ;// returns LRESULT in lResult
, "UInt" , _ctrlID ;// handle to destination control
, "UInt" , 0x4df ;// message ID (EM_SETFONTSIZE := WM_USER + 223)
, "UInt" , opt1 ;// wParam - Change in point size of the selected text (–1637 to 1638)
, "Cdecl UInt" , 0) ;// lParam - This parameter is not used; it must be zero.
Return ;// Return Value: This message does not return a value.
} ;-----------------------------
; Else If _action = EM_GETSELTEXT
; {
; ;-- The EM_GETSELTEXT message retrieves the starting and ending character positions of the selection in a rich edit control.
; DllCall("SendMessage" ;// returns LRESULT in lResult
; , "UInt" , _ctrlID ;// handle to destination control
; , "UInt" , 0x43e ;// message ID (EM_GETSELTEXT := WM_USER + 62)
; , "UInt" , 0 ;// wParam - This parameter is not used; it must be zero.
; , "Cdecl Str" , &_tmp1) ;// lParam - Pointer to a buffer that receives the selected text. The calling
; ; application must ensure that the buffer is large enough to hold
; ; the selected text.
; Return _tmp1 ;// Return Value: Message returns the # of chars copied, not including the terminating null character
; } ;-----------------------------
; Else If _action = EM_GETTEXTRANGE
; {
; ;-- The EM_GETTEXTRANGE message retrieves a specified range of characters from a rich edit control.
; VarSetCapacity(_tmp1, 512, 0) , InsertInteger(2, _tmp1, 4)
; InsertInteger(10, _tmp1, 8) , InsertInteger(_tmp1, _tmp1, 12)
; _tmp2 := DllCall("SendMessage" ;// returns LRESULT in lResult
; , "UInt" , _ctrlID ;// handle to destination control
; , "UInt" , 0x44b ;// message ID (EM_GETTEXTRANGE := WM_USER + 75)
; , "UInt" , 0 ;// wParam - This parameter is not used; it must be zero.
; , "Cdecl Str" , &_tmp1) ;// lParam - Pointer to a TEXTRANGE structure; specifies the range of
; ; characters to retrieve and a buffer to copy the characters to.
; Return ExtractInteger(_tmp1, 0) . "|" . ExtractInteger(_tmp1, 12) ;// Return Value: returns TEXTRANGE Structure (chrg & lpstrText)
; } ;-----------------------------
; Else If _action = EM_SETCHARFORMAT
; {
; ;-- The EM_SETCHARFORMAT message sets character formatting in a rich edit control.
; VarSetCapacity(_tmp1, 32, 0) , InsertInteger(32, _tmp1, 16)
; DllCall("SendMessage" ;// returns LRESULT in lResult
; , "UInt" , _ctrlID ;// handle to destination control
; , "UInt" , 0x444 ;// message ID (EM_SETCHARFORMAT := WM_USER + 68)
; , "UInt" , 0 ;// wParam - Character formatting that applies to the control
; , "Cdecl Str" , &_tmp1) ;// lParam - Pointer to a CHARFORMAT structure specifying the character formatting to use
; Return ExtractInteger(_tmp1, 0) . "|" . ExtractInteger(_tmp1, 4) ;// Return Value: returns TEXTRANGE Structure (chrg & lpstrText)
; } ;-----------------------------
; Else If _action = EM_SETPAGEROTATE
; {
; ;-- Deprecated. An application sends an EM_SETPAGEROTATE message to set the text layout for a Microsoft RE control
; _tmp1 := DllCall("SendMessage" ;// returns DWORD in lResult
; , "UInt" , _ctrlID ;// handle to destination control
; , "UInt" , 0x45d ;// message ID (EM_SETPAGEROTATE := WM_USER + 93)
; , "UInt" , 90 ;// wParam - Text layout value (EPR_0, EPR_90, EPR_180, EPR_270)
; , "UInt" , 0) ;// lParam - Not used; must be zero.
; Return _tmp1 ;// Return Value: the new text layout value
; } ;-----------------------------
I attempted wrapping up a few more.. but now (
being a dllcall noob) I'm hitting a brick wall when it comes to effectively using/understanding structures. I managed to get a simple one working.. but I'm not understanding how to create one w/ Int & Str's in it & ones where one of the members is another structure! (Ex. The TEXTRANGE Structure uses a CHARRANGE Structure as one of its members..)
You can strip off all the BS comments (I left them there to make it easier for someone more experienced to double check..) as well as come up w/ a better naming convention; I'm going to continue trying to improve my knowledge & will maybe post new ones as I get them figured out.
Quote:
As you may have guessed, this function isn't designed only for use with a RICHEDIT
control.
This has quite a bit of potential.. & I'm axious to see how it develops
