1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
//Récupération de l'URL en cours dans Internet Explorer
function GetCurrentInternetExplorerURL:string;
var Explorer,ClientWork,Toolbar,ComboBox,ComboBoxChild,Edit:HWND;
Mem:integer;
begin
//Retrouve le Handle de la fenêtre principale
Explorer:=FindWindow('IEFrame',nil);
if Explorer=0 then
Result:=''
else
begin
//Cherche le Handle de la fenêtre de travail
ClientWork:=FindWindowEx(Explorer,0,'WorkerA',nil);
if ClientWork=0 then
//Compatibilité XP / 98
ClientWork:=FindWindowEx(Explorer,0,'WorkerW',nil);
//Retrouve le Handle de la ToolBar
Toolbar:=FindWindowEx(ClientWork,0,'ReBarWindow32',nil);
//Cherche le Handle du ComboBox
ComboBox:=FindWindowEx(Toolbar,0,'ComboBoxEx32', nil);
ComboBoxChild:=FindWindowEx(ComboBox,0,'ComboBox',nil);
//Atteint l'Edit et envoie un message pour avoir le texte
Edit:=FindWindowEx(ComboBoxChild,0,'Edit',nil);
Mem:=SendMessage(Edit,WM_GETTEXTLENGTH,0,0)+1;
SetLength(Result,Mem);
//Envoi du message
SendMessage(Edit,WM_GETTEXT,Mem,Integer(@Result[1]));
end;
end; |
Partager