IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Web & réseau Delphi Discussion :

'ComboBoxEx32' sous vista ne fonctionne pas ?


Sujet :

Web & réseau Delphi

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Juillet 2007
    Messages : 70
    Points : 49
    Points
    49
    Par défaut 'ComboBoxEx32' sous vista ne fonctionne pas ?
    Bonjour,

    J'ai trouvé le moyen d'optenir l'url de IE mais sous vista il semble qu'il y ait un petit problème.

    Est-ce que dans la version vista IE n'aurait pas l'objet 'ComboBoxEx32' ?

    Dans le code qui suit tout fonctionne bien sauf la ligne :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
            hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ComboBoxEx32', nil);
    voici la fonction

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    function GetUrlFromIE (Handle: THandle; List: TStringList): boolean; stdcall;
    var
      hWndIE, hWndIEChild : HWND;
      Buffer : array[0..255] of Char;
    begin
      //get the window caption
      SendMessage(Handle, WM_GETTEXT, 255, integer(@Buffer[0]));
     
      //look for the Internet Explorer window with "Buffer" caption
      hWndIE := FindWindow(Pchar('IEFrame'), Buffer);
      if hWndIE > 0 then
      begin
     
        //try to get a handle to IE's toolbar container
        hWndIEChild := FindWindowEx(hWndIE, 0, 'WorkerW', nil);
        if hWndIEChild > 0 then
        begin
          //get a handle to address bar
          hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ReBarWindow32', nil);
          if hWndIEChild > 0 then
          begin
            //finally, locate combo box and add its text to the list
            hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ComboBoxEx32', nil);
            if hWndIEChild > 0 then
            begin
              SendMessage(hWndIEChild, WM_GETTEXT, 255, integer(@Buffer));
              List.AddObject(Buffer,TObject(hWndIE));
            end;
          end;
        end;
      end;
      //continue enumeration
      Result :=True;
    end; (*GetUrlFromIE*)
    si quelqu'un a une solution... merci d'avance

    Ajout : Avec IE7 il faut utiliser 'TabwindowClass' et non 'ComboBoxEx32'

    mais je n'arrive toujours pas a recevoir L'url.

  2. #2
    Expert éminent sénior
    Avatar de ShaiLeTroll
    Homme Profil pro
    Développeur C++\Delphi
    Inscrit en
    Juillet 2006
    Messages
    13 459
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Seine Saint Denis (Île de France)

    Informations professionnelles :
    Activité : Développeur C++\Delphi
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2006
    Messages : 13 459
    Points : 24 873
    Points
    24 873
    Par défaut
    Ils ont peut-être changer la classe, vista apporte une nouvelle lib de composant windows (v5 pour 2000, v6 pour XP, et v7 pour Vista il me semble) mais peu probable que des composants soient retiré (compatibilité oblige)

    Tu devrais essayer ce code, il est possible que l'imbrication des composants soit différente, ce code te donnera un TreeView (genre l'arborscence des classes en Delphi)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    procedure TFrm_ShowTreeWindow.GenererArbre(HandleArbre: THandle);
     
      function GetClassAndCaption(aHandle: THandle): string;
      var
        lpRes : array[0..256] of Char;
        StrClass: string;
        StrCaption: string;
      begin
          GetClassName(aHandle, lpRes, SizeOf(lpRes));
          StrClass := lpRes;
          GetWindowText(aHandle, lpRes, SizeOf(lpRes));
          StrCaption := lpRes;
          Result := Format('%s : "%s" (%d)', [StrClass, StrCaption, aHandle])
      end;
     
      function GetWindowList(HandleStart: THandle; RelationStart: Cardinal; RelationDirection: Cardinal = GW_HWNDNEXT): TStringList;
      var
        HandleFound: THandle;
      begin
         Result := TStringList.Create();
     
         HandleFound := GetWindow(HandleStart, RelationStart);
         repeat
             if (HandleFound <> 0) and (HandleFound <> HandleStart) then
             begin
                Result.AddObject(GetClassAndCaption(HandleFound), Pointer(HandleFound));
             end;
             HandleFound := GetWindow(HandleFound, RelationDirection);
          until (HandleFound = 0);
      end;
     
      function GetFreres(HandleFrere: THandle): TStringList;
      begin
         Result := GetWindowList(HandleFrere, GW_HWNDFIRST);
      end;
     
      function GetEnfants(HandleParent: THandle): TStringList;
      begin
         Result := GetWindowList(HandleParent, GW_CHILD);
      end;
     
      function GetParents(HandleEnfant: THandle): TStringList;
      begin
         Result := GetWindowList(HandleEnfant, GW_OWNER, GW_OWNER);
      end;
     
      procedure ArbreEnfant(Tree: TTreeNodes; Node: TTreeNode; HandleParent: THandle);
      var
         EnfantsList: TStringList;
         IndexEnfant: Integer;
         NewNode: TTreeNode;
      begin
         EnfantsList := GetEnfants(HandleParent);
         try
            EnfantsList.Sort();
            for IndexEnfant := 0 to EnfantsList.Count-1 do
            begin
               NewNode := Tree.AddChildObject(Node, EnfantsList.Strings[IndexEnfant], EnfantsList.Objects[IndexEnfant]);
               ArbreEnfant(Tree, NewNode, THandle(EnfantsList.Objects[IndexEnfant]));
            end;
         finally
           EnfantsList.Free();
         end;
      end;
     
      function SameParent(ParentHandle, HandleFrere: THandle): Boolean;
      var
         ParentList: TStringList;
      begin
         Result := False;
     
         ParentList := GetParents(HandleFrere);
         try
            if ParentList.Count > 0 then
               Result := THandle(ParentList.Objects[ParentList.Count-1]) = ParentHandle;
         finally
           ParentList.Free();
         end;
     
      end;
     
    var
      ParentList, FreresList: TStringList;
      IndexParent, IndexFrere: Integer;
      ItemSelectNode, ParentNode, FrereNode, VoisinNode, Node: TTreeNode;
      HandleTopParent: THandle;
    begin
      HandleTopParent := 0;
     
      TreeView3.Items.BeginUpdate();
      try
         TreeView3.Items.Clear();
     
         ItemSelectNode := TreeView3.Items.Add(nil, 'Element Sélectionné');
         Node := TreeView3.Items.AddChildObject(ItemSelectNode, GetClassAndCaption(HandleArbre), Pointer(HandleArbre));
         ArbreEnfant(TreeView3.Items, Node, HandleArbre);
     
         ParentNode := TreeView3.Items.Add(ItemSelectNode, 'Parent');
         ParentList := GetParents(HandleArbre);
         Node := ParentNode;
         try
            if ParentList.Count > 0 then
               HandleTopParent := THandle(ParentList.Objects[ParentList.Count-1]);
     
            for IndexParent := ParentList.Count-1 downto 0 do
            begin
                Node := TreeView3.Items.AddChildObject(Node, ParentList.Strings[IndexParent], ParentList.Objects[IndexParent]);
            end;
         finally
           ParentList.Free();
         end;
     
         FrereNode := TreeView3.Items.Add(ItemSelectNode, 'Frères');
         VoisinNode := TreeView3.Items.Add(FrereNode, 'Voisins');
         FreresList := GetFreres(HandleArbre);
         FreresList.Sort();
         try
            for IndexFrere := 0 to FreresList.Count-1 do
            begin
                if SameParent(HandleTopParent, Integer(FreresList.Objects[IndexFrere])) then
                   Node := FrereNode
                else
                   Node := VoisinNode;
     
                Node := TreeView3.Items.AddChildObject(Node, FreresList.Strings[IndexFrere], FreresList.Objects[IndexFrere]);
     
                ArbreEnfant(TreeView3.Items, Node, THandle(FreresList.Objects[IndexFrere]));
            end;
         finally
           FreresList.Free();
         end;
      finally
         TreeView3.Items.EndUpdate();
      end;
     
    end;
    Aide via F1 - FAQ - Guide du développeur Delphi devant un problème - Pensez-y !
    Attention Troll Méchant !
    "Quand un homme a faim, mieux vaut lui apprendre à pêcher que de lui donner un poisson" Confucius
    Mieux vaut se taire et paraître idiot, Que l'ouvrir et de le confirmer !
    L'ignorance n'excuse pas la médiocrité !

    L'expérience, c'est le nom que chacun donne à ses erreurs. (Oscar Wilde)
    Il faut avoir le courage de se tromper et d'apprendre de ses erreurs

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2007
    Messages
    70
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Juillet 2007
    Messages : 70
    Points : 49
    Points
    49
    Par défaut
    gros merci.

    Je viens d'essayer le code mais dans toute l'arborescence je ne suis capable d'extraire qu'un seul lien HTTP.
    En fait, il s'agit du combobox principal et le lien affiché correspond a celui de l'onglet actif.

    je ne trouve rien pour aller chercher le lien http de chaque onglet sans être obligé de les rendre actifs un a un.

    Question : Se pourrait-il que je doive utiliser une fonction non mentionnée ?

Discussions similaires

  1. Le diaporama sous Vista ne fonctionne pas
    Par Thomas1405 dans le forum Windows Vista
    Réponses: 2
    Dernier message: 18/09/2009, 22h18
  2. div overflow sous firefox ne fonctionne pas
    Par ptitpoisson dans le forum Balisage (X)HTML et validation W3C
    Réponses: 4
    Dernier message: 06/08/2007, 17h09
  3. Réponses: 15
    Dernier message: 01/05/2007, 00h54
  4. [Sous Requete] ne fonctionne pas => incompréhensible
    Par soad029 dans le forum Langage SQL
    Réponses: 9
    Dernier message: 24/04/2007, 17h42
  5. Réponses: 6
    Dernier message: 23/12/2006, 12h46

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo