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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
   |  
 
AnsiString TForm1::URL()
{
 
//Récupération de l'URL en cours dans Internet Explorer
 
// j'utilise SetWindowText pour faire un test !
// si c'est trouvé je change le texte du handle
 
//Retrouve le Handle de la fenêtre principale
int Mem;
HWND Explorer,ClientWork,Toolbar,ComboBox,ComboBoxChild,Edit;
 
Mem=0;
Explorer = NULL;
ClientWork = NULL;
Toolbar = NULL;
ComboBox = NULL;
ComboBoxChild = NULL;
Edit = NULL;
AnsiString Result = "Error";
 
    Explorer = FindWindow("IEFrame",0);
    if ( Explorer == NULL )  return Result;
    SetWindowText(Edit,"IEFrame");          // ceci est un test 
 
    //Cherche le Handle de la fenêtre de travail
    ClientWork = FindWindowEx(Explorer,0,"WorkerA",NULL);
    if ( ClientWork == NULL)
     {//Compatibilité XP / 98
       ClientWork = FindWindowEx(Explorer,0,"WorkerW",NULL);
    }else return "WorkerA_W";                  // permet voir ou il y a erreur
    SetWindowText(Edit,"WorkerA");           // ceci est un test 
 
    //Retrouve le Handle de la ToolBar
    Toolbar = FindWindowEx(ClientWork,0,"ReBarWindow32",NULL);
    if ( Toolbar == NULL) return "ReBarWindow32";
    SetWindowText(Edit,"ReBarWindow32");    // ceci est un test 
 
    //Cherche le Handle du ComboBox
    ComboBox = FindWindowEx(Toolbar,0,"ComboBoxEx32", NULL);
    if ( ComboBox == NULL) return "ComboBoxEx32";
    SetWindowText(Edit,"ComboBoxEx32");
 
    ComboBoxChild = FindWindowEx(ComboBox,0,"ComboBox",NULL);
    if ( ComboBoxChild == NULL) return "ComboBox";
    SetWindowText(Edit,"ComboBox");
 
    //Atteint l'Edit et envoie un message pour avoir le texte
    Edit = FindWindowEx(ComboBoxChild,0,"Edit",NULL);
    if ( Edit == NULL) return "Edit";
    SetWindowText(Edit,"Edit");
 
    Mem = GetWindowTextLengthA(Edit);
    char *szTitre;
    szTitre = new char[Mem+1];
    GetWindowTextA(Edit,szTitre,Mem+1);
 
    return szTitre;
 
    //listView->Items->Add( szTitre );
    //SendMessageA(Form1->listView->Handle,WM_GETTEXT,Mem+1,long(Result[1])); | 
Partager