Anyone know how to set a window's frame thickness?

Started by kdmoyers, December 12, 2013, 09:19:06 AM

Previous topic - Next topic

kdmoyers

I need to reduce the screen space taken up by a certain 3rd party program, and was hoping to do this by reducing the thickness of the frame surrounding the window, perhaps reducing it all the way to zero.

I need to preserve the caption of the window, so the user can access the system menu and grab the caption to slide the window around. 

I was hoping to find some clever "SetWindowLongA" dll call, but so far no luck.

Anyone know a trick for this?

TIA,
Kirby
The mind is everything; What you think, you become.

Deana

You can get the height of a window title bar using WinMetrics option 4. WinMetrics options 7 & 8 can GET the width/height of dialog box frames.

I perused the list of window styles and didn't find anything useful: http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600(v=vs.85).aspx and http://msdn.microsoft.com/en-us/library/windows/desktop/ff700543(v=vs.85).aspx.

As I understand it the window border size is a global setting in windows: http://www.sevenforums.com/tutorials/6283-borders-changing-width-suite-your-needs.html.

Take a look at the SysParamInfo option 6: SetBorder - Sets the border multiplier factor that determines the width of a window's sizing border.

Apparently you can also set this value in the registry:
http://www.howtogeek.com/130138/how-to-change-the-window-border-size-in-windows-8/

Any one else?



Deana F.
Technical Support
Wilson WindowWare Inc.

kdmoyers

yeah, I was afraid of that.  Seems like removing the caption (top bar) of a window is a cinch, but getting rid of the surrounding border is a whole nother thing...  rats.
The mind is everything; What you think, you become.

....IFICantBYTE

Don't know if you can get the desired frame you want by playing around with various style values in this, but here it is anyway...

Code (winbatch) Select
#DefineFunction WinStyleTest(title);Use at own risk.. some styles may stop your window working properly
;see http://msdn.microsoft.com/en-us/library/windows/desktop/ms633591(v=vs.85).aspx
;see http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600(v=vs.85).aspx
GWL_STYLE = -16
GWL_EXSTYLE = -20
WS_OVERLAPPED = 0;Same as WS_TILED   You could almost think of this as the generic default window for most applications.. It has a Title bar and a Border
WS_BORDER = 8388608
WS_CAPTION = 12582912
WS_DLGFRAME = 4194304
WS_SIZEBOX = 262144;Same as WS_THICKFRAME
WS_HSCROLL = 1048576
WS_VSCROLL = 2097152

WS_EX_CLIENTEDGE = 512
WS_EX_DLGMODALFRAME = 1
WS_EX_STATICEDGE = 131072
WS_EX_TOOLWINDOW = 128
WS_EX_WINDOWEDGE = 256


hWnd=DllHwnd(title)
DllUSER32=strcat(DirWindows(1),"USER32.DLL")
Style=DllCall(DllUSER32,long:"GetWindowLongA",long:hWnd,long:GWL_STYLE)
StyleEx=DllCall(DllUSER32,long:"GetWindowLongA",long:hWnd,long:GWL_EXSTYLE)

Message("Current Styles: Style and StyleEx",Style:@CR:StyleEx)

Style = Style ^ WS_DLGFRAME
   StyleEx=StyleEx ^ WS_EX_TOOLWINDOW

   DllCall(DllUSER32,long:"SetWindowLongA",long:hWnd,long:GWL_STYLE,long:Style)

   DllCall(DllUSER32,long:"SetWindowLongA",long:hWnd,long:GWL_EXSTYLE,long:StyleEx)

DllCall(DllUSER32,long:"SetWindowPos", long:hWnd, long:0, long:0, long:0, long:0, long:0, long:32|2|1);Redraw
#EndFunction


;WinStyleTest("Untitled - Notepad")
WinStyleTest("Calculator")
Regards,
....IFICantBYTE

Nothing sucks more than that moment during an argument when you realize you're wrong. :)

kdmoyers

Quote from: ....IFICantBYTE on December 12, 2013, 07:03:02 PM
Don't know if you can get the desired frame you want by playing around with various style values in this, but here it is anyway...
Thanks! what a great tool for testing!
-Kirby
The mind is everything; What you think, you become.