WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Locate Taskbar UDF


I needed to have a dialog tied to the lower right corner of the screen, and I used the logic I found on the techsupport site, and it works fine, unless you have a double height taskbar, or the taskbar is not on the bottom.

I was able to modify the code to take into account the height of the taskbar. I have not been able to fix it for different locations, but I have come up with a solution to locate the taskbar that I think might be useful to people.

#DefineFunction LocateTaskBar()
   sWorkArea                  = SysParamInfo(48, "", 0)
   iResolutionX               = WinMetrics(0)
   iResolutionY               = WinMetrics(1)

   iLeft                     = ItemExtract(1, sWorkArea, ",")
   iTop                     = ItemExtract(2, sWorkArea, ",")
   iRight                     = ItemExtract(3, sWorkArea, ",")
   iBottom                     = ItemExtract(4, sWorkArea, ",")

   If iBottom                  <> iResolutionY
      iTBLocation               = 0   ;"Bottom"
   EndIf

   If iLeft == 0 && iRight == iResolutionX && iBottom == iResolutionY
      iTBLocation               = 1 ;"Top"
   EndIf

   If iTop == 0 && iRight == iResolutionX && iBottom == iResolutionY
      iTBLocation               = 2 ;Left"
   EndIf

   If iBottom == iResolutionY && iRight <> iResolutionX && iBottom == iResolutionY
      iTBLocation               = 3 ;"Right"
   EndIf

   ;This can be used to prove it.
   ;sText = StrCat("Work Area (L, T, R, B) = ", sWorkArea, @CRLF, "Task bar is on - ", iTBLocation, @CRLF)
   ;sText = StrCat(sText, "iLeft = ", iLeft, @CRLF)
   ;sText = StrCat(sText, "iTop = ", iTop, @CRLF)
   ;sText = StrCat(sText, "iRight = ", iRight, @CRLF)
   ;sText = StrCat(sText, "iBottom = ", iBottom, @CRLF)
   ;sText = StrCat(sText, "iResolutionX = ", iResolutionX, @CRLF)
   ;sText = StrCat(sText, "iResolutionY = ", iResolutionY, @CRLF)
   ;Message("", sText)
   Return iTBLocation
#EndFunction

Article ID:   W17228
File Created: 2007:07:03:14:28:54
Last Updated: 2007:07:03:14:28:54