whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1541)

Database (90)
Files (137)
Forms (107)
Graphic (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Math (76)
Misc (126)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (266)
VCL (242)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

16 Visitors Online


 
...get selected text from IE window?
Autor: Zilvinas Ledas
Homepage: http://mokslas.liux.lt
[ Print tip ]  

Tip Rating (8):  
     


uses
  
SHDocVw_TLB; // http://www.euromind.com/iedelphi if don't have that unit

function GetSelectedIEtext: string;
var
  
x: Integer;
  Sw: IShellWindows;
  IE: HWND;
begin
  
IE := FindWindow('IEFrame', nil);
  sw := CoShellWindows.Create;
  for x := SW.Count - 1 downto do
    if 
(Sw.Item(x) as IWebbrowser2).hwnd = IE then begin
      
Result := variant(Sw.Item(x)).Document.Selection.createRange.Text;
      break;
    end;
end;

 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners