Post by donnybowers on Nov 21, 2018 23:32:50 GMT -5
I'm having trouble setting the Z order I want for a window using STYLEBITS: BOTTOM, NOTOPMOST, TOP, TOPMOST. The only one that works for me is TOPMOST.
I have a program that has a main window and then calls various other windows to sit on top of it. These are basically LISTBOXes that call up various files in a text editor. The text editor is set for "stay on top". But when I use TOPMOST for my listboxes the text editor comes up behind it. I'm thinking NOTOPMOST or TOP would work better for my LISTBOX windows, but as I say, for some reason the only one that works with STYLEBITS is TOPMOST.
I run LB under WINE, so I'm wondering if that might be the problem. I'm also wondering if there's an API workaround. I know WINE must be able to handle most Windows API's because they work in other applications (like the text editor I'm using which I believe is using the TOP Z order). Having these different Z levels would be a huge improvement to my program.
donnybowers, apparently it is not stylebits. It is Windows constants - but for another function.
This. If you want to use those flags, you need to use them in conjunction with the SetWindowPos() API call. Also note that this is temporary arrangement of the Z-order; it does not permanently "stick" a window in place.
Here's an example call to the SetWindowPos function, specifically to change Z-Order. You need to get the hMain handle from one of your windows.
You can also use the second parameter to set the z-order of a window to specifically behind another window.
a = SetWindowZOrder(hMain, _HWND_NOTOPMOST)
Function SetWindowZOrder(hWnd, hWndInsertAfter) 'Tell SetWindowPos() that we're not moving or resizing the window, 'just changing Z-order. ' 'This way, it will ignore what we pass for window position and 'window size parameters. uFlags = _SWP_NOSIZE or _SWP_NOMOVE SetWindowZOrder = SetWindowPos(hWnd, hWndInsertAfter, 0, 0, 0, 0, uFlags) End Function
Function SetWindowPos(hWnd, hWndInsertAfter, x, y, cx, cy, uFlags) CallDLL #user32, "SetWindowPos",_ hWnd as ulong,_ hWndInsertAfter as long,_ x as long,_ y as long,_ cx as long,_ cy as long,_ uFlags as long,_ SetWindowPos as long End Function