Click here to Skip to main content
15,900,378 members
Home / Discussions / C#
   

C#

 
GeneralRe: How do you organize your projects? Pin
Heath Stewart16-Sep-04 5:21
protectorHeath Stewart16-Sep-04 5:21 
GeneralDecision help please Pin
Jayne Klaus Smith15-Sep-04 10:43
Jayne Klaus Smith15-Sep-04 10:43 
GeneralRe: Decision help please Pin
Christian Graus15-Sep-04 10:50
protectorChristian Graus15-Sep-04 10:50 
GeneralRe: Decision help please Pin
Adam °Wimsatt15-Sep-04 11:26
Adam °Wimsatt15-Sep-04 11:26 
GeneralRe: Decision help please Pin
Heath Stewart15-Sep-04 11:55
protectorHeath Stewart15-Sep-04 11:55 
GeneralRe: Decision help please Pin
Heath Stewart15-Sep-04 11:58
protectorHeath Stewart15-Sep-04 11:58 
QuestionHow to get highlighted text from a window e.g IE? Pin
Palfo15-Sep-04 10:24
sussPalfo15-Sep-04 10:24 
AnswerRe: How to get highlighted text from a window e.g IE? Pin
Heath Stewart15-Sep-04 10:37
protectorHeath Stewart15-Sep-04 10:37 
There is no universal way. Internet Explorer and other Microsoft COM servers (like Word) use a TextRange object. From Internet Explorer - if you have a reference to the current IHTMLDocument2, you can create a TextRange by using IHTMLDocument2.selection to get an IHTMLSelectionObject, and if not null call IHTMLSelectionObject.createRange. The process is similar for Office products, but uses Office-specific objects to get a TextRange (a different class but works the same).

For text boxes and rich edit controls (encapsulates by the TextBox and RichTextBox controls, but are just Windows Common Controls classes "EDIT" and "RichEdit" (1.0), "RichEdit20A" (2.0; ANSI), or "RichEdit20W" (2.0; Unicode), you can P/Invoke SendMessage and pass EM_GETSEL (or EM_GETSELTEXT for Rich Edit controls - both work but work differently) to the control's HWND (exposed by the Control.Handle property inheritted by each control in Windows Forms).

If this is from another application to which you don't have a reference (or handle), P/Invoke FindWindow and/or FindWindowEx. This process has been discussed many times in this forum so click "Search comments" for more information.


This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles]
GeneralRe: How to get highlighted text from a window e.g IE? Pin
fossmo16-Sep-04 11:17
fossmo16-Sep-04 11:17 
GeneralRe: How to get highlighted text from a window e.g IE? Pin
Heath Stewart16-Sep-04 11:57
protectorHeath Stewart16-Sep-04 11:57 
GeneralRe: How to get highlighted text from a window e.g IE? Pin
fossmo21-Sep-04 11:30
fossmo21-Sep-04 11:30 
GeneralSNMP Traps Pin
sin6715-Sep-04 9:58
sin6715-Sep-04 9:58 
GeneralRe: SNMP Traps Pin
Heath Stewart15-Sep-04 10:27
protectorHeath Stewart15-Sep-04 10:27 
GeneralRe: SNMP Traps Pin
sin6726-Oct-04 9:01
sin6726-Oct-04 9:01 
QuestionFile/Directory Exists? Pin
tdciDoug15-Sep-04 9:56
tdciDoug15-Sep-04 9:56 
AnswerRe: File/Directory Exists? Pin
SandeepN15-Sep-04 10:24
SandeepN15-Sep-04 10:24 
GeneralRe: File/Directory Exists? Pin
tdciDoug15-Sep-04 10:36
tdciDoug15-Sep-04 10:36 
GeneralRe: File/Directory Exists? Pin
mav.northwind15-Sep-04 23:09
mav.northwind15-Sep-04 23:09 
GeneralUsing a application already open to display files Pin
smartyosu15-Sep-04 9:50
smartyosu15-Sep-04 9:50 
GeneralRe: Using a application already open to display files Pin
SandeepN15-Sep-04 10:47
SandeepN15-Sep-04 10:47 
GeneralRe: Using a application already open to display files Pin
smartyosu15-Sep-04 12:01
smartyosu15-Sep-04 12:01 
GeneralRe: Using a application already open to display files Pin
Heath Stewart15-Sep-04 14:22
protectorHeath Stewart15-Sep-04 14:22 
QuestionWhat does an end user need to run a C# 2005 beta compiled app? Pin
benjymous15-Sep-04 9:48
benjymous15-Sep-04 9:48 
AnswerRe: What does an end user need to run a C# 2005 beta compiled app? Pin
Nnamdi Onyeyiri15-Sep-04 10:28
Nnamdi Onyeyiri15-Sep-04 10:28 
GeneralFlash Movie on Forms Pin
Salman Taseer`15-Sep-04 9:46
Salman Taseer`15-Sep-04 9:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.