Hi all!
I'm searching for a Trick to align an own Window on the left side of my desktop where all other opened windows aligns to.
Like the Taskbar at the bottom of a screen. If I switch a window to fullscreen the window fits to the maximum size of the desktopheight-taskbarheight.
Is this possible in PB?
Cheers
Mike
Fixed Window on desktop like Taskbar?!
Re: Fixed Window on desktop like Taskbar?!
I don't understand (sorry). Do you want to open your own window at the
left of the screen, and force all other windows to not cover it when opened,
but to have their left edge aligned with the right edge of your window?
left of the screen, and force all other windows to not cover it when opened,
but to have their left edge aligned with the right edge of your window?
Re: Fixed Window on desktop like Taskbar?!
PB you understand right! That is 100% that what I mean. sorry my bad frozen english.PB wrote:I don't understand (sorry). Do you want to open your own window at the
left of the screen, and force all other windows to not cover it when opened,
but to have their left edge aligned with the right edge of your window?

Mike
Tranquil
Re: Fixed Window on desktop like Taskbar?!
> That is 100% that what I mean
Cool!
Here's a really bad example then... there must be better ways to
do it than this. This simply checks the position of every window and moves
it to the right of your window if it covers it. Not a good way to do it, but
perhaps someone else can come up with a better solution?
A funny tip: If you add the #PB_Window_Invisible flag to your window, then
you get an area on the Desktop that no other window can cover... nice!
Cool!

do it than this. This simply checks the position of every window and moves
it to the right of your window if it covers it. Not a good way to do it, but
perhaps someone else can come up with a better solution?
A funny tip: If you add the #PB_Window_Invisible flag to your window, then
you get an area on the Desktop that no other window can cover... nice!
Code: Select all
If OpenWindow(0,0,0,50,999,#PB_Window_SystemMenu,"test")
SetWindowPos_(WindowID(),#HWND_TOPMOST,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE)
Repeat
Sleep_(1) : ev=WindowEvent()
r=GetWindow_(GetDesktopWindow_(),#GW_CHILD)
Repeat
GetWindowRect_(r,win.RECT) : x=win\left : y=win\top : w=win\right-win\left : h=win\bottom-win\top
If x<WindowWidth() And r<>WindowID()
MoveWindow_(r,WindowWidth()+GetSystemMetrics_(#SM_CXFRAME),y,w,h,#TRUE)
EndIf
r=GetWindow_(r,#GW_HWNDNEXT)
Until r=0
Until ev=#PB_Event_CloseWindow
EndIf
Took some time to find out, but this works quite well...
Note:
You only need to take care of MAXIMIZED windows, as non-maximized
windows can also be moved over the area of the real Taskbar, only
Maximized Windows do not overlap it. This code behaves like the real
Taskbar, the only difference is it's look, but maybe you can change that
with some flags also, to make it look the same.
Hope it helps...
Timo
Note:
You only need to take care of MAXIMIZED windows, as non-maximized
windows can also be moved over the area of the real Taskbar, only
Maximized Windows do not overlap it. This code behaves like the real
Taskbar, the only difference is it's look, but maybe you can change that
with some flags also, to make it look the same.
Hope it helps...
Timo
Code: Select all
; Callback to update all non-child maximized windows
Procedure.l UpdateWindowsProc(hWnd.l, *desktop.RECT)
If IsZoomed_(hWnd)
MoveWindow_(hWnd, *desktop\left, *desktop\top, *desktop\right-*desktop\left, *desktop\bottom-*desktop\top, #TRUE)
EndIf
ProcedureReturn #TRUE
EndProcedure
; Get actual desktop size (without Taskbar)
SystemParametersInfo_(#SPI_GETWORKAREA, 0, @desktop.RECT, 0)
If OpenWindow(0, desktop\left, desktop\top, 0, 0, #PB_Window_SystemMenu, "")
; resize Window to not overlap the Taskbar, and to 50 pixel width
SetWindowPos_(WindowID(),#HWND_TOPMOST,0,0,50,desktop\bottom-desktop\top,#SWP_NOMOVE)
; now calculate the new desktop rectangle
desktopnew.RECT
desktopnew\left = desktop\left + WindowWidth() + GetSystemMetrics_(#SM_CXFIXEDFRAME)*2
desktopnew\right = desktop\right
desktopnew\top = desktop\top
desktopnew\bottom = desktop\bottom
; set new desktop rectangle
SystemParametersInfo_(#SPI_SETWORKAREA, 0, @desktopnew, #SPIF_SENDWININICHANGE)
; update all windows (because most do not react to the #WM_SETTINGCHANGE message
EnumWindows_(@UpdateWindowsProc(), @desktopnew)
; here comes all the rest of your prog (in my case, only wait)
Repeat
Until WaitWindowEvent() = #PB_EventCloseWindow
; reset desktop to old size
SystemParametersInfo_(#SPI_SETWORKAREA, 0, @desktop, #SPIF_SENDWININICHANGE)
; update windows again
EnumWindows_(@UpdateWindowsProc(), @desktop)
EndIf
End
quidquid Latine dictum sit altum videtur
AppBars
Though I'm sure that works much the same (can't try right now!), I believe this is 'meant' to be done with AppBars:
http://msdn.microsoft.com/library/en-us ... ppbars.asp
I tried once, but only got it partly working...
http://msdn.microsoft.com/library/en-us ... ppbars.asp
I tried once, but only got it partly working...