Re: Size of task bar

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Fri, 2 Jun 2000 01:24:17 +0100, Agent Spectre wrote:

>Is there any way to get the current size of the task bar?
>
>Pete King
>

I wrote this Win32Lib 'add-on' that returns the coordinates of the desktop
work area (usually the 'Screen' size minus the task bar).  I wrote this so
that I could center a window or determine the size and location of a
maximized window, taking into consideration the size and location of the
task bar.

-- sysparams.ew
-- This 'add-on' requires Win32Lib.ew by David Cuny
-- Brian K. Broker - APR 2000
-- email: bkb at cnw.com

include Win32Lib.ew

constant
  xSystemParameters = linkFunc(user32, "SystemParametersInfoA",
                              {C_UINT, C_UINT, C_POINTER, C_UINT}, C_LONG),
  SPI_GETWORKAREA = 48

-----------------------------------------------------------

global function getWorkarea()
  -- Returns: sequence containing the coordinates of the work area,
  --            expressed in virtual screen coordinates {x1,y1, x2,y2}
  atom workarea
  sequence wa_out

  -- get pointer for RECT structure to recieve coordinates
  workarea = allocate_struct( SIZEOF_RECT )

  -- call C function from user32.dll
  if not c_func( xSystemParameters, {SPI_GETWORKAREA, 0, workarea, 0} ) then
    warnErr( "getWorkarea:SystemParametersInfo failed" )
  end if

  -- set return sequence
  wa_out = { fetch( workarea, rectLeft ),  fetch( workarea, rectTop ),
             fetch( workarea, rectRight ), fetch( workarea, rectBottom ) }

  -- free pointer
  free( workarea )

  return wa_out
end function

-----------------------------------------------------------

-- hope this helps
-- Brian

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu