mIRC Homepage
Posted By: naki taskbar size - 21/09/06 12:58 AM
is there a way you can get the size of the windows taskbar in pixels using mirc script?
Posted By: Sephiroth_ Re: taskbar size - 21/09/06 04:48 PM
Only if mIRC is maximized (or use a transparent @window that pops up just for calculating)

$window(-1).h returns the screen height

lets start calculating wink

mIRC is maximized and $window(-2).h returns mIRCs height
$calc($window(-1).h - $window(-2).h) = your taskbar size blush

if your mIRC isn't maximized use something like this:
Code:
alias calctaskbarsize {
  if ($appstate == maximized) { return $calc($window(-1).h - $window(-2).h) }
  else {
    window -dnh @calctaskbarsize
    if ($istok(2K3 2K XP,$os,32)) { setlayer 0 @calctaskbarsize }
    window -x @calctaskbarsize
    var %s = $calc($window(-1).h - $window(@calctaskbarsize).h) 
    window -c @calctaskbarsize
    return %s
  }
}
Posted By: Scorpwanna Re: taskbar size - 21/09/06 07:15 PM
I guess that's a no naki frown.

There is a flaw there, a typical start menu is 28 pixels high.
My screen resolution is 1024x768.

When I use $window(-1).h it returns 768
if I use $window(-2).h it returns 748
You say that that shows the height of mirc's window.

How could mirc be 748 if the taskbar is 28 itself and my screen height is 768?
768 - 748 = 20
Taskbar = 28

748 + 28 = 776

Taking a snapshot of the screen and using a good ole adobe program tells me that the true height of mirc window maximized is 740

Does that mean mirc is hiding 8 pixels height somewhere behind something?
Posted By: Scorpwanna Re: taskbar size - 21/09/06 07:53 PM
Look what I DID!

//echo -ag Taskbar starts from the top of the screen until the $taskbarstarts pixel.
Code:
alias taskbarstarts {
  window -Bdhk0 +dL @taskbarcalc $window(-1).w $window(-1).h 1 1
  window -o @taskbarcalc
  var %taskbarstarts = $calc($window(@taskbarcalc).y +1)
  window -c @taskbarcalc
  return %taskbarstarts 
}


Thanks Sephiroth_ smile
Posted By: Sephiroth_ Re: taskbar size - 21/09/06 07:58 PM
It depends also on the theme and so on... also if your taskbar is fixed or not (under XP)
Posted By: Scorpwanna Re: taskbar size - 21/09/06 08:40 PM
Yeah, though ive tested what I made off of your example and it seems flawless smile. Thanks again. You pointed me in the right direction. mIRC can even be minimized or any shape and it works.
© mIRC Discussion Forums