Get Selected Text 
Author Message
 Get Selected Text

What is the API that I can use to get selected text ?
I believe it has something to do with the EM_GETSEL constant, just not sure
what message it is


Sat, 28 Jun 2003 03:25:02 GMT  
 Get Selected Text
Selected text from a textbox?
StrVar = Text1.SelText


Quote:
> What is the API that I can use to get selected text ?
> I believe it has something to do with the EM_GETSEL constant, just not
sure
> what message it is



Sat, 28 Jun 2003 04:47:19 GMT  
 Get Selected Text
Hi,

You can use the API SendMessage function with the constant EM_GETSELTEXT.
The EM_GETSELTEXT message retrieves the currently selected text in a rich
edit control.

To send this message, call the SendMessage function with the following
parameters.

SendMessage(
  (HWND) hWnd,              // handle to destination window
  EM_GETSELTEXT,            // message to send
  (WPARAM) wParam,          // not used; must be zero
  (LPARAM) lParam          // selected text (LPSTR)
);
Parameters
  wParam
  This parameter is not used.
  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 Values
This message returns the number of characters copied, not including the terminating null character.

Declare:

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Declare WM_USER = &H400

Private Declare EM_GETSELTEXT  = WM_USER + 62

Siri Mette

Quote:

> What is the API that I can use to get selected text ?
> I believe it has something to do with the EM_GETSEL constant, just not sure
> what message it is



Sat, 28 Jun 2003 05:15:53 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. getting selected text in a module?

2. Getting selected text from a listview

3. Getting Selected text

4. Getting selected text from any window class

5. Getting the selected text

6. Getting Selected Shape Text

7. Select all text when selecting a text box?

8. selecting text in TextBox upon getting focus

9. Getting the selected text

10. ? Changing font of Selected text (How to select?)

11. ? Changing font of Selected text (How to select?)

12. Selecting Text in a text form field.

 

 
Powered by phpBB® Forum Software