Bruce's Powerbuilder Tricks

SHAppBarMessage

SHAppBarMessage - Bruce's Powerbuilder Tricks The best use I have come up with this so far was to use to block a portion of my niece's laptop screen which was broken and no longer worked. While windows can still get behind the taskbar (just like they can with windows task bar), at least if you can maximize the window now, you can get to ALL of it.

appbar.ini is simple:
[AppBar]
# Top Bottom Right Left (first character)
Where=R
# Size in Pixels
Size=400

From Powerbuilder, the most important piece is the definition of the window. It MUST be a popup window. And it must have PalletteWindow checked.

Function Definitions
function long SHAppBarMessage (long dwMessage, ref appbardata pdata) library "shell32.dll"
//Some versions may require alias for "SHAppBarMessage;Ansi"
function long GetSystemMetrics (long nIndex) library "user32.dll"

Private Structure appbardata
long cbsize
long hwnd
long ucallbackmessage
long uedge
long left
long top
long right
long bottom
boolean lparam
I delcared this is i_pdata

set the size of the structure to 24 and the handle this the handle of our window
i_pdata.cbsize = 24
i_pdata.hwnd = handle(this)

and tell windows we are a new incarnation (abm_new = 0)
shappbarmessage (abm_new, i_pdata)

Then, query system metrics for the width and height of the screen. Tell windows what size you would LIKE the task bar to be. (It may tell you something different.)
i_pdata.uedge = abe_bottom // abe_left=0, abe_top=1, abe_right=2, abe_bottom=3 i_pdata.right = getSystemMetrics (sm_cxscreen) // sm_cxscreen=0
i_pdata.bottom = getSystemMetrics (sm_cyscreen) // sm_cyscreen=1
i_pdata.left = 0
i_pdata.top = 200 // The height of your task bar

and ask windows where it can live:
shappbarmessage (abm_querypos, i_pdata) // abm_querypos=2

and use what it sent back to you to position everything
move (PixelsToUnits(i_pdata.left, xPixelsToUnits!), PixelsToUnits(i_pdata.top, yPixelsToUnits!))
resize (PixelsToUnits(i_pdata.right - i_pdata.left, xPixelsToUnits!), PixelsToUnits(i_pdata.bottom - i_pdata.top, yPixelsToUnits!))

and then tell windows you are actually there
shappbarmessage (abm_setpos, i_pdata) // abm_setpos = 3

BE SURE IF YOU CLOSE THE WINDOW, YOU TELL WINDOWS YOU ARE DONE
shappbarmessage (abm_remove, i_pdata) // abm_remove = 1

Example files:
appbar.pbl
appbar.exe
appbar.ini