🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #3067

Re: how to get the height of the taskbar using BCB

#3067
From: Remy Lebeau (TeamB)
Date: Wed, 20 Sep 2006 03:51
37 lines
2165 bytes
"Liu Shan" <liushan@ps-electronic.com> wrote in message
news:4510b10b$1@newsgroups.borland.com...

> Does somebody know how to get the height of the taskbar using BCB?

    APPBARDATA abd = {sizeof(APPBARDATA), 0};
    abd.hWnd = FindWindow("Shell_TrayWnd", NULL);

    if( SHAppBarMessage(ABM_GETTASKBARPOS, &abd) )
        // use abd.rc as needed ...

Alternatively:

    RECT r = {0};
    HWND hWnd = FindWindow("Shell_TrayWnd", NULL);
    GetWindowRect(hWnd);
    // use r as needed ...

> I need to arrange a few windows on window screen, need to
> calculate the window's height to void overlapping taskbar. which
> function can call to get the height of the taskbar?

You are not taking into account that the Taskbar can be on the side of the
screen instead of the top or bottom, or that the Taskbar can be hidden when
not used.  You should instead be using SystemParametersInfo() to get the
work area of the desktop.  Then you don't have to care about the Taskbar at
all.  For example:

    RECT r = {0};
    if( SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0) )
    {
        // position the windows within the bounds of the RECT as needed ...
    }


Gambit
Technical Details
Message-ID: <4510bb8e$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!news.glorb.com!tudelft.nl!txtfeed1.tudelft.nl!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4510b10b$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,267f749a6d7cfe7
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4510b10b$1@newsgroups.borland.com>
Subject: Re: how to get the height of the taskbar using BCB
Date: Tue, 19 Sep 2006 20:51:21 -0700
Lines: 39
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 69.169.4.232
Message-ID: <4510bb8e$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1158724494 69.169.4.232 (19 Sep 2006 20:54:54 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!news.glorb.com!tudelft.nl!txtfeed1.tudelft.nl!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail