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

C# Discussion :

Information sur la TaskBar de windows


Sujet :

C#

  1. #1
    Membre averti Avatar de Seth77
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Octobre 2005
    Messages
    1 448
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Octobre 2005
    Messages : 1 448
    Points : 410
    Points
    410
    Par défaut Information sur la TaskBar de windows
    Salut

    Comment peut connaitre la taille et la position de la taksbar de windows ?

    thx ++

  2. #2
    Rédacteur
    Avatar de Thomas Lebrun
    Profil pro
    Inscrit en
    Octobre 2002
    Messages
    9 161
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France

    Informations forums :
    Inscription : Octobre 2002
    Messages : 9 161
    Points : 19 434
    Points
    19 434
    Par défaut
    Via les API Windows peut-être ?

  3. #3
    Expert éminent
    Avatar de smyley
    Profil pro
    Inscrit en
    Juin 2003
    Messages
    6 270
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 6 270
    Points : 8 344
    Points
    8 344
    Par défaut
    Utilise GetWindowRect avec comme handle la valeur de retour de
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    FindWindow("Shell_TrayWnd", NULL);
    ( avec des P/Invoke ... )

  4. #4
    Membre averti Avatar de Seth77
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Octobre 2005
    Messages
    1 448
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Octobre 2005
    Messages : 1 448
    Points : 410
    Points
    410
    Par défaut
    Merci ...

    Cad : avec des P/Invoke ???

  5. #5
    Expert éminent
    Avatar de smyley
    Profil pro
    Inscrit en
    Juin 2003
    Messages
    6 270
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 6 270
    Points : 8 344
    Points
    8 344
    Par défaut
    Alala

    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
     
    [Serializable, StructLayout(LayoutKind.Sequential)]
            public struct RECT
            {
                public int Left;
                public int Top;
                public int Right;
                public int Bottom;
     
                public RECT(int left_, int top_, int right_, int bottom_)
                {
                    Left = left_;
                    Top = top_;
                    Right = right_;
                    Bottom = bottom_;
                }
     
                public int Height { get { return Bottom - Top; } }
                public int Width { get { return Right - Left; } }
                public Size Size { get { return new Size(Width, Height); } }
     
                public Point Location { get { return new Point(Left, Top); } }
     
                // Handy method for converting to a System.Drawing.Rectangle
                public Rectangle ToRectangle()
                { return Rectangle.FromLTRB(Left, Top, Right, Bottom); }
     
                public static RECT FromRectangle(Rectangle rectangle)
                {
                    return new RECT(rectangle.Left, rectangle.Top, rectangle.Right, rectangle.Bottom);
                }
     
                public override int GetHashCode()
                {
                    return Left ^ ((Top << 13) | (Top >> 0x13))
                      ^ ((Width << 0x1a) | (Width >> 6))
                      ^ ((Height << 7) | (Height >> 0x19));
                }
     
                #region Operator overloads
     
                public static implicit operator Rectangle(RECT rect)
                {
                    return rect.ToRectangle();
                }
     
                public static implicit operator RECT(Rectangle rect)
                {
                    return FromRectangle(rect);
                }
     
                #endregion
            }
     
            [DllImport("user32.dll")]
            static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
     
            [DllImport("user32.dll", SetLastError = true)]
            static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
     
            Rectangle GetTaskBarCoords()
            {
                IntPtr shell = FindWindow("Shell_TrayWnd", "");
                RECT rect;
                GetWindowRect(shell, out rect);
                return new Rectangle(rect.Left, rect.Top, rect.Width, rect.Height);
            }

  6. #6
    Membre averti Avatar de Seth77
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Octobre 2005
    Messages
    1 448
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Octobre 2005
    Messages : 1 448
    Points : 410
    Points
    410
    Par défaut
    Merci !


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

Discussions similaires

  1. Réponses: 2
    Dernier message: 02/10/2009, 13h20
  2. Réponses: 2
    Dernier message: 20/10/2008, 21h36
  3. Réponses: 7
    Dernier message: 20/11/2007, 13h34
  4. Réponses: 8
    Dernier message: 22/06/2007, 00h39
  5. Informations sur un exe (dans les propriétés windows)
    Par SteelBox dans le forum Windows
    Réponses: 6
    Dernier message: 06/07/2004, 18h20

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