Posición barra de tareas

HMG en Español

Moderator: Rathinagiri

Post Reply
User avatar
edufloriv
Posts: 240
Joined: Thu Nov 08, 2012 3:42 am
DBs Used: DBF, MariaDB, MySQL, MSSQL, MariaDB
Location: PERU

Posición barra de tareas

Post by edufloriv »

Saludos amigos,

Existe alguna función para saber la posición actual de la barra de tareas de Windows ? Es decir si esta abajo, a la derecha o a la izquierda ?

Saludos y gracias anticipadas.

Eduardo Flores Rivas


LIMA - PERU
User avatar
AUGE_OHR
Posts: 2096
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Posición barra de tareas

Post by AUGE_OHR »

hi,

i have a Solution for Xbase++ which DLLFUNCTION can be "re-write" for HMG Syntax

Code: Select all

#include "ShellApi_constants.ch"

STATIC DLLFUNCTION SHAppBarMessage( nMessage, @sAppBarData )    USING STDCALL FROM shell32.dll
STATIC DLLFUNCTION FindWindowA( cClassName, cWindowName  )      USING STDCALL FROM user32.dll
STATIC DLLFUNCTION SendMessageA( hWnd, nMsg, nWparam, nLparam ) USING STDCALL FROM user32.dll
STATIC DLLFUNCTION GetWindowLongA( nHwnd, nStyle )              USING STDCALL FROM User32.dll
STATIC DLLFUNCTION SetWindowLongA( nHwnd, nStyle, nPtr )        USING STDCALL FROM User32.dll


FUNCTION TaskBarInfo()
LOCAL sAppBarMessage
LOCAL rc, cText
LOCAL lAutoHide, lAlwaysOnTop
LOCAL nOldState, nState
LOCAL nIndex, nEdge, sRect
LOCAL nTop, nLeft, nBottom, nRight
LOCAL TrayWindow
LOCAL aRet := {}

   // Fensterhandle des Taskbar holen
   TrayWindow := FindWindowA('Shell_traywnd',0)

   // Position und Koordinaten ermitteln
   sAppBarMessage := U2Bin(36) + L2Bin(TrayWindow) + replicate( U2Bin(0), 7 )
   rc := SHAppBarMessage( ABM_GETTASKBARPOS, @sAppBarMessage )

   nIndex := 13
   nEdge := Bin2U( substr(sAppBarMessage, nIndex, 4) ) ; nIndex += 4
   sRect := substr( sAppBarMessage, nIndex, 16 )

   cText := "Position: "
   DO CASE
   CASE nEdge = ABE_LEFT
      cText += "LINKS"
   CASE nEdge = ABE_TOP
      cText += "OBEN"
   CASE nEdge = ABE_RIGHT
      cText += "RECHTS"
   CASE nEdge = ABE_BOTTOM
      cText += "UNTEN"
   ENDCASE

   AADD(aRet, STRTRAN(cText,"Position: ","") )

   cText  += ", Koordinaten: "
   nIndex := 1
   nLeft  := Bin2L( substr(sRect, nIndex, 4) ) ; nIndex += 4
   nTop   := Bin2L( substr(sRect, nIndex, 4) ) ; nIndex += 4
   nRight := Bin2L( substr(sRect, nIndex, 4) ) ; nIndex += 4
   nBottom := Bin2L( substr(sRect, nIndex, 4) ) ; nIndex += 4

   cText += var2char( {nLeft, nTop, nRight, nBottom} )

   AADD(aRet, {nLeft, nTop, nRight, nBottom} )

RETURN aRet
have fun
Jimmy
Post Reply