views:

24

answers:

1

Hi guys,

Is there any possible way to get the height of the lower menu bar - the one with the start menu - on windows mobile 6.5.3? I can get the height of the upper menu bar using different ways, such as using function SystemParametersInfo and sending SPI_GETWORKAREA as its uiAction parameter, or using GetMonitorInfo function, but all of these functions can help to calculate the height of the upper menu bar.

With previous versions of windows mobile, the height of the upper and lower bars was standard, 26 pixels for QVGA devices and 52 for VGA devices, but this is not the case in windows mobile 6.5.3, where the upper bar has a height of 18, and the lower only God knows for now :)

Thank you in advance for any help.

Ayman

A: 

It's actually called the lower taskbar.

hTBWnd = FindWindow(_T("HHTaskBar"), NULL)

This gets you a handle to the taskbar. Then you can use GetWindowRect to get the four corners of the taskbar, and calculated height by subtracting top from bottom. If HHTaskBar isn't found, Tray may work.

HWND hTBWnd;
RECT windowRect;

hTBWnd = FindWindow(_T("HHTaskBar"), NULL);
if (hTBWnd != NULL) 
{
  GetWindowRect(hwnd, &windowRect);
  CString csLongAsString;
  csLongAsString.Format( _T( "Height: %ld" ), windowRect.bottom - windowRect.top );
  MessageBox(NULL, csLongAsString, _T("HHTaskBar"), MB_OK);
  return(0);
} else
{
  hTBWnd = FindWindow(_T("Tray"), NULL);
  if (hTBWnd != NULL) 
  {
    GetWindowRect(hwnd, &windowRect);
    CString csLongAsString;
    csLongAsString.Format( _T( "Height: %ld %ld" ), windowRect.bottom, windowRect.top );
    MessageBox(NULL, csLongAsString, _T("Tray"), MB_OK);
  } else 
  {
    MessageBox(NULL, _T("Window get failed"), _T("FAILED TO FIND WINDOW"), MB_OK);
    return(0);
  }
}
Keir Finlow-Bates
As a matter of fact I tried HHTaskBar and didn't work, but I will try Tray and see if it works, thank you :)
Ayman