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 :

ShellExecute , Internet Explorer et fenêtre active


Sujet :

Web & réseau Delphi

  1. #1
    Membre régulier
    Inscrit en
    Mars 2002
    Messages
    240
    Détails du profil
    Informations forums :
    Inscription : Mars 2002
    Messages : 240
    Points : 102
    Points
    102
    Par défaut ShellExecute , Internet Explorer et fenêtre active
    j'ouvre une fenêtre Internet Explorer à l'aide de la routine ShellExecute.
    Cette fenêtre est bien affichée mais bizarrement elle n'est pas toujours active : la barre de titre (celle du haut donc) est grisée (au lieu d'etre bleue) ...
    comment corriger ce problème svp ?

  2. #2
    Membre régulier Avatar de yoghisan
    Profil pro
    Inscrit en
    Février 2004
    Messages
    172
    Détails du profil
    Informations personnelles :
    Âge : 51
    Localisation : France

    Informations forums :
    Inscription : Février 2004
    Messages : 172
    Points : 113
    Points
    113
    Par défaut
    Tu as essayé de ce cote là ?
    Tu as plusieurs possibilités pour la dernière commande "ShellExecute"

    SW_HIDE
    Hides the window and activates another window.
    SW_MAXIMIZE
    Maximizes the specified window.
    SW_MINIMIZE
    Minimizes the specified window and activates the next top-level window in the z-order.
    SW_RESTORE
    Activates and displays the window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when restoring a minimized window.
    SW_SHOW
    Activates the window and displays it in its current size and position.
    SW_SHOWDEFAULT
    Sets the show state based on the SW_ flag specified in the STARTUPINFO structure passed to the CreateProcess function by the program that started the application. An application should call ShowWindow with this flag to set the initial show state of its main window.
    SW_SHOWMAXIMIZED
    Activates the window and displays it as a maximized window.
    SW_SHOWMINIMIZED
    Activates the window and displays it as a minimized window.
    SW_SHOWMINNOACTIVE
    Displays the window as a minimized window. The active window remains active.
    SW_SHOWNA
    Displays the window in its current state. The active window remains active.
    SW_SHOWNOACTIVATE
    Displays a window in its most recent size and position. The active window remains active.
    SW_SHOWNORMAL
    Activates and displays a window. If the window is minimized or maximized, Windows restores it to its original size and position. An application should specify this flag when displaying the window for the first time.


    SINON
    voir du coté du handle !

    Tu récuperes le handle de ta fenetre
    Comment récupérer les handles des fenêtres d'un processus ?

    et apres tu as des fonctions pour la rendre active et/ou la mettre au premier plan
    Il existe des sources un peu partout pour ca.

  3. #3
    Membre régulier
    Inscrit en
    Mars 2002
    Messages
    240
    Détails du profil
    Informations forums :
    Inscription : Mars 2002
    Messages : 240
    Points : 102
    Points
    102
    Par défaut
    j'ai essayé avec les paramètres SW_SHOWNORMAL ou SW_SHOW
    et donc certaines fois la fenêtre IE est active et d'autres fois non

  4. #4
    Membre régulier
    Inscrit en
    Mars 2002
    Messages
    240
    Détails du profil
    Informations forums :
    Inscription : Mars 2002
    Messages : 240
    Points : 102
    Points
    102
    Par défaut
    j'ai testé ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    var 
      handle_fenetre : HWND;
    begin
          handle_fenetre := ShellExecute(0,'open',PChar(nom_exec),PChar(url_addr),nil,SW_SHOWNORMAL);
     
          if handle_fenetre > 32 then
          begin
            SetActiveWindow(handle_fenetre);
     
    ...
    Mais rien pas d'amélioration ...

  5. #5
    Membre confirmé
    Avatar de lil_jam63
    Profil pro
    Inscrit en
    Janvier 2004
    Messages
    447
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2004
    Messages : 447
    Points : 600
    Points
    600
    Par défaut
    Normal puisque le handle retourné par shellExcute n'est pas un vrai handle
    Citation Envoyé par Extrait MSDN
    Returns a value greater than 32 if successful, or an error value that is less than or equal to 32 otherwise. The following table lists the error values. The return value is cast as an HINSTANCE for backward compatibility with 16-bit Windows applications. It is not a true HINSTANCE, however. The only thing that can be done with the returned HINSTANCE is to cast it to an int and compare it with the value 32 or one of the error codes below.
    .
    Si tu veux controler ton process, utilise plutot createProcess().

  6. #6
    Membre régulier
    Inscrit en
    Mars 2002
    Messages
    240
    Détails du profil
    Informations forums :
    Inscription : Mars 2002
    Messages : 240
    Points : 102
    Points
    102
    Par défaut
    je pense avoir résolu le problème avec les routines de l'API windows:

    - je lance le prog fenêtré (IE 5) avec ShellExecute
    - je récuprère son handle de fenêtre grâce à FindWindow
    - j'active cette fenêtre (barre de titre en bleue) avec SetForegroundWindow

  7. #7
    Membre régulier Avatar de yoghisan
    Profil pro
    Inscrit en
    Février 2004
    Messages
    172
    Détails du profil
    Informations personnelles :
    Âge : 51
    Localisation : France

    Informations forums :
    Inscription : Février 2004
    Messages : 172
    Points : 113
    Points
    113
    Par défaut
    C'est ce que je disais dès le début... seulement je ne connaissais que la méthode et pas la synthaxe. De plus, je suis autodidacte et je n'utilise pas forcément le bon vocabulaire et c'est donc de ma faute, je n'ai pas réussi à me faire comprendre correctement, tu aurais perdu moins de temps...

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Maximiser Active X dll Internet explorer
    Par imparator_42 dans le forum VB 6 et antérieur
    Réponses: 2
    Dernier message: 18/04/2008, 17h30
  2. Activities pour Internet Explorer 8
    Par adhes dans le forum Général Conception Web
    Réponses: 1
    Dernier message: 30/03/2008, 21h52
  3. Fenêtre pop-up, Internet explorer 6
    Par Opérateur dans le forum Windows 2000/Me/98/95
    Réponses: 1
    Dernier message: 16/01/2008, 14h30
  4. Internet Explorer OLEControl ou ShellExecute
    Par JYves dans le forum Windows
    Réponses: 1
    Dernier message: 09/08/2006, 10h59
  5. Réponses: 16
    Dernier message: 25/11/2005, 09h53

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