Les Snippets

Connexion

Récupérer la hauteur de la barre des tâches

Niveau requis pour utiliser/comprendre cette source : 1 ( Débutant )
Créé le 11/02/2007 23:04:01 et initié par WhiteHippo [Liste]
Date de mise à jour : 16/02/2007 18:20:53
Vue : 7603
Catégorie(s) : API, Trucs & Astuces
Langages dispo pour ce code :
- Delphi 5
- Delphi 5
- Delphi 5
- Delphi 5
- C
- Voir tous les langages pour ce code snippet



Langage : Delphi 5
Date ajout : 16/02/2007
Posté par f0xi [Liste]
DateMAJ : 16/02/2007
{**
   Petite variante par rapport au code de WhiteHippo 
   permet de recuperer : 
   origine (LxT) de la barre des taches
   taille (WxH) de la barre des taches
   handle de la barre des taches
   position (L, T, R, B) de la barre des taches
**}

const
  { utilisé pour la valeur du flag TTaskBarInfo.Position }
  TASKBAR_POSITION_UNKNOW = byte($00);
  TASKBAR_POSITION_LEFT   = byte($01); 
  TASKBAR_POSITION_TOP    = byte($02);
  TASKBAR_POSITION_RIGHT  = byte($03);
  TASKBAR_POSITION_BOTTOM = byte($04);

type
  { utilisé par la fonction GetTaskBarInfos }
  TTaskBarInfo = record
     Left     : integer;
     Top      : integer;
     Width    : integer;
     Height   : integer;
     Position : byte;
     Handle   : HWND;
  end;

{ GetTaskBarInfos
   
  Recupere les informations (origine, taille, position, handle) de la barre des
  taches de windows.
  Params
     tbi [O] TTaskBarInfo structure
  Return
     boolean, true si reussite de l'operation
}
function GetTaskBarInfos(var tbi : TTaskBarInfo) : boolean;
var R : TRect;
    DL,DT,DW,DH : integer;
begin
  with tbi do
  begin
    Handle := FindWindow('Shell_TrayWnd',''); { @User32.FindWindowA }
    result := Handle <> INVALID_HANDLE_VALUE;
    if result then
    begin
      result := GetWindowRect(Handle, R); { @User32.GetWindowRect}
      if result then
      begin
        Left   := R.Left;
        Top    := R.Top;
        Width  := R.Right - R.Left;
        Height := R.Bottom - R.Top;
        DL     := Screen.DesktopLeft;
        DT     := screen.DesktopTop;
        DW     := screen.DesktopWidth;
        DH     := Screen.DesktopHeight;
        if (Left = DL) and (Top = DT) and (Width = DW) and (Height < DH) then
           Position := TASKBAR_POSITION_TOP
        else
        if (Left = DL) and (Top > DT) and (Width = DW) and (Height < DH) then
           Position := TASKBAR_POSITION_BOTTOM
        else
        if (Left = DL) and (Top = DT) and (Width < DW) and (Height = DH) then
           Position := TASKBAR_POSITION_LEFT
        else
        if (Left > DL) and (Top = DT) and (Width < DW) and (Height = DH) then
           Position := TASKBAR_POSITION_RIGHT
        else
           Position := TASKBAR_POSITION_UNKNOW;
      end;
    end;
  end;
end;


Snippets en rapport avec : Barre, Tâches, Windows, Hauteur



Codes sources en rapport avec : Barre, Tâches, Windows, Hauteur

{C / C++ / C++.NET} MODIFIER LA HAUTEUR DE LA BARRE DE TACHES
problème: quelle que soit la hauteur de la barre de tache avant l'extinction de Windows XP, celle-...

{JAVA / J2EE} PLEIN ECRAN EN TENANT COMPTE DE LA BARRE DES TACHES
Apparement c'est une question récurente dans le forum alors voila un petit bout de code ;)...

{C / C++ / C++.NET} ICONE DANS LA BARRE DES TACHES AVEC MENU (VC++)
Illustration pour mettre et enlever une icone dans la barre de taches avec gestion d'un menu. J'ai ...

{Visual Basic, VB6, VB.NET, VB 2005} MASQUER LA BARRE DES TÂCHES WINDOWS
...

{Javascript / DHTML} AFFICHE DE 1 A PLEIN DE MESSAGES DANS LA BARRE DE STATUT DU VISITEUR
Comme son nom l'indique se petit bout de script affichera des messages qui défileront successivement...

{Delphi} BARRE DE PROGRESSION À LA CLEARLOOKS
Voici un composant basé sur la librairie Graphics32 qui permet d'être utilisé en tant que barre de p...

{Javascript / DHTML} CONFORTABLE AUTO DÉFILEMENT OU (SCROLL BAR) TOUT AUTOMATIQUE AVEC VITESSE LIBREMENT VARIABLE
Confortable auto défilement ou (scroll bar) tout automatique avec vitesse librement variable: c'est...

{Visual Basic, VB6, VB.NET, VB 2005} WIN++ OPTIONS AVANCÉES SUR LES FENETRES ET PROCESSUS WINDOWS (CPU LIMITER, CTRL ALT END, METTRE EN PAUSE UN PROCESSUS...)
Bonjour à tous, Voici un programme dont le but est le suivant : Rassembler toutes les petites so...

{Visual Basic, VB6, VB.NET, VB 2005} API WIN32 FACILE
petit exemple d'utilisation des api j'ai utilisé P/Invoke Interop Assistant pour les quelques fo...

{Visual Basic, VB6, VB.NET, VB 2005} AUTHENTIFICATION WINDOWS
Bonjour, suite à plusieurs post, je vous propose un bout de code permettant de mettre une forme e...