height of taskbar

Post Reply
Johnny Yiu
Posts: 11
Joined: Thu Nov 24, 2005 4:02 am

height of taskbar

Post by Johnny Yiu »

Can I use getsysmetrics() to retrive the height of the windows taskbar?
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: height of taskbar

Post by Enrico Maria Giordano »

Yes, but you have to subtract the value returned by the API SystemParametersInfo() with the argument SPI_GETWORKAREA.

EMG
Johnny Yiu
Posts: 11
Joined: Thu Nov 24, 2005 4:02 am

Post by Johnny Yiu »

Enrico,

Can you please show me how to do it. What value to use for getsysmetrics()?
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

This should be a working sample:

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    ? GETTASKBARHEIGHT()

    RETURN NIL


#pragma BEGINDUMP

#include "windows.h"
#include "hbapi.h"

HB_FUNC( GETTASKBARHEIGHT )
{
    RECT rct;

    LONG nHDiff, nVDiff;

    SystemParametersInfo( SPI_GETWORKAREA, 0, &rct, 0 );

    nHDiff = GetSystemMetrics( SM_CXSCREEN ) - ( rct.right - rct.left );
    nVDiff = GetSystemMetrics( SM_CYSCREEN ) - ( rct.bottom - rct.top );

    if ( nHDiff > 0 )
        hb_retnl( nHDiff );
    else
        hb_retnl( nVDiff );
}

#pragma ENDDUMP
EMG
Johnny Yiu
Posts: 11
Joined: Thu Nov 24, 2005 4:02 am

Post by Johnny Yiu »

Enrico,

As always you been a great help, thanks.
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re:

Post by Bayron »

Enrico,

This same function SystemParametersInfo() can be used to set the height of the top window border.. Am I right???

Do you think you can help me with it????? I am building a Touch Screen App, the default sysmenu is too small for that...
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Re:

Post by Enrico Maria Giordano »

Bayron wrote:This same function SystemParametersInfo() can be used to set the height of the top window border.. Am I right???
No, as far as I know.

EMG
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: height of taskbar

Post by Bayron »

Thnx Enrico...

I found a way of doing what I need, but I don't know anything about C
http://www.codeproject.com/KB/vista/Aer ... wsApp.aspx


Image
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Re:

Post by Bayron »

Enrico,
Image
I think it can be done this way using c++

Code: Select all

    if ( !IsThemeNull() )
        GetThemeSysFont ( TMT_MSGBOXFONT, &lf );
    else
        {
        NONCLIENTMETRICS ncm = { sizeof(NONCLIENTMETRICS) };

        SystemParametersInfo ( SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, false );
        lf = ncm.lfMessageFont;
        }
 
***********************************
from MSDN:

SPI_GETNONCLIENTMETRICS
0x0029

Retrieves the metrics associated with the nonclient area of nonminimized windows. The pvParam parameter must point to a NONCLIENTMETRICS structure that receives the information. Set the cbSize member of this structure and the uiParam parameter to sizeof(NONCLIENTMETRICS).

Public Domain Code from:
http://www.codeproject.com/KB/vista/VGGlassIntro.aspx
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: height of taskbar

Post by Enrico Maria Giordano »

Yes, I was wrong: according to MSDN, SystemParametersInfo() can also be used to set the parameters but I never done it and can't help you, sorry.

EMG
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: height of taskbar

Post by Bayron »

Enrico,

Thanks a lot anyway; at least it's a start, maybe someone else may help...

I know that Laiton is working with FiveTechSoft to implement something like this to FiveWin....
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: height of taskbar

Post by Bayron »

=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
Post Reply