Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

windows 7 - border fill - problem of window not fitting completely on the screen

Status
Not open for further replies.

miguelleeuwe

Programmer
Oct 17, 2007
242
NL
Hi all,

windows 7 - border fill has a value of 4. Our applicationa has been designed at minimum resolution of 1024x768.

problem:
problem of window not fitting completely on the screen at resolution of 1024.

If setting manually the windows border fill to 0 (aero themes) or use windows classic Theme, everything goes fine but client does not want to oblige all of it's users to do so.

We have too many windows to manually redesign them to occupy less.

In registry exists "PaddedBorderWidth" (someway the value assigned shows as 'value x -15') but users do not have rights to change the setting manually and would affect other many applications at client).

Decided to used api: "SetWindowTheme" and so far achieved to assign windows classic theme to the main window, but border thickness (really 'border edge fill' still remains the same: 4 or whatever users assigned in his windows settings (metrics).

Does anyone know how to change the border thickness (edge fill) by means of API functions?

I'd be very greatfull sin msdn documentation is quit miserable.

TIA,
Miguel Leeuwe

regards,
Miguel L.
 
Maybe you can use the GetWindowLong / SetWindowLong API combination.

My blog entry on them

There is a 'thin border' window style which may be of use. I think, however, it will make the window non resizable but I am not sure since I have not tried to do what you are asking.

Window Style info

Matt

"Nature forges everything on the anvil of time"
 
Hello Matt,

Thank You very much for the information:

The link you gave me to "the anvil of time" is exactly what I tried in the first place, sin I already used your information one month ago to do exactly what is says: Create a resizable response window.

the problem I have, is that our main window has to be resizable. When Applying making the window resizable using THICK_BORDER / BOX_STYLE the border thickness is the one specified in Windows (the one thats too wide).

I tried to trick the window in assiging another value (something "DLG_" don't remember right now) and got very close to the solution: obtained a resizable window with thin borders (like in modal window/dialog) but ... the problem I couldn't solve was the left and right border reserved in the title/caption-bar:
It seemed as if kept using the THICK_BORDER for the title bar and tried really hard to obtain the information to change the border size (left and right) of the CAPTION, but did not succeed.
(what I did was apply WS_DLGFRAME to make the thick borders disappear if I remember well....)

Still I'll keep trying to use this approach since it seems easier and more independent of themes than by using the api's for "visual styles" of windows.

I'll let you know if/when I solve the problem, lots of coffee tonight! :)

king regards,
Miguel


regards,
Miguel L.
 
Hi Matt/anySoul,

Lots of coffee, little advance.

What's your opinion on using the "CreateWindowEx()" APi instead of pb's "Open()" function? Might that be a way to solve my problem?

kind regards,
miguel

regards,
Miguel L.
 
Not sure CreateWindowEx is the way to go, sounds like a lot of trial and error.
Just an idea... Have you tried to create the window without a titlebar, change the border style, then add the titlebar back on the window (I'm not sure this can even be done)?

Matt

"Nature forges everything on the anvil of time"
 
hi Matt,

I didn't aswer untill now, since I've been trying your SetWindowLong() approach.
First of all, there seems to be a huge difference in the type of window I part from: Main or Response.

It seems like being response the SetWindowLong behaves better, but still .. I need a resizable main (with thin border). I tried al kinds of combinations, but simply can't seem to override the thick border that I need to be able to resize. I add some garbage code as proof. Even if I seem to get a thin border that can be resized (so far only parting from a powerbuilder response-type window), as soon as I resize the thick border appears again (might be solved by repeating my code from Open event in pbm_paint event?)

I'll try the CreateWindowEx, if I'm lucky enough to find any examples.

Thank you, I'll keep you informed.

(OMG, Sunday ... friends coming over, beer, rum, swimming-pool, more beer and then soccer game: Spain-Italy!!!!
I'd better rush, thank god it's only 5:46 in the morning haha!)


regards,
Miguel L.
 
Forgot the 'garbage code' present in Open event:

// <!-- mjleeuwe 11/06/2012 [#360791 "Ventana tipo response. Redimensionable"
ulong ll_style
CONSTANT Int GWL_STYLE = -16
CONSTANT Long WS_THICKFRAME = 262144
CONSTANT Long WS_SYSMENU = 524288
CONSTANT Long WS_CAPTION = 524288
CONSTANT Long WS_OVERLAPPED = 0
CONSTANT Long WS_MAXIMIZEBOX = 65536
CONSTANT Long WS_MINIMIZEBOX = 131072
CONSTANT Long WS_DLGFRAME = 4194304

ll_style = GetWindowLong(Handle(This), GWL_STYLE)

IF ll_style > 0 THEN
// SetWindowLong(Handle(this), GWL_STYLE, ll_style + WS_SYSMENU )
// ll_style = GetWindowLong(Handle(This), GWL_STYLE)
SetWindowLong(Handle(this), GWL_STYLE, ll_style + WS_THICKFRAME +WS_SYSMENU)
ll_style = GetWindowLong(Handle(This), GWL_STYLE)
// SetWindowLong(Handle(this), GWL_STYLE, ll_style + WS_THICKFRAME + WS_SYSMENU + WS_MAXIMIZEBOX + WS_MINIMIZEBOX)
// ll_style = GetWindowLong(Handle(This), GWL_STYLE)
// SetWindowLong(Handle(this), GWL_STYLE, ll_style + WS_CAPTION)
// SetWindowLong(Handle(this), GWL_STYLE, ll_style + WS_SYSMENU + WS_CAPTION + WS_MAXIMIZEBOX + WS_MINIMIZEBOX)
// SetWindowLong(Handle(this), GWL_STYLE, ll_style + WS_SYSMENU + WS_MAXIMIZEBOX + WS_MINIMIZEBOX)
END IF
// mjleeuwe 11/06/2012 [#360791 -->

regards,
Miguel L.
 
Hi!

I'm close to the solution of my problem:

In the end I forgot about CreateWindow(Ex) since I realized my problem cannot be fixed with neither C++. My conclusion is that to be able to resize you simply must apply the WS_THICKFRAME.

So, reconsidering ... my real problem only exists when the window is Maximized.
- Since our frame window is opened in a maximized state anyway, the user will have to do a RESTORE before being able to resize it anyway ....
- While window in a restored state, I don't care if parts of the window are not visible because of the thick border, since there'll be V/Hscrollbars.


now what I'm trying is:
[ul]
[li]in resize event check if sizetype indicates 'restore' or 'maximize' of the window[/li]
[li]in resize event when restoring: apply thickFrame[/li]
[li]in resize event when maximizing: take away - thickFrame[/li]
[/ul]-

The only problem left is that I'm using of_bitwiseOr() and not sure if that is correct:
- when doing the same operation several times, the window starts to behave badly: no good redraw, menu titlebar disappears, etc.

Should I use of_bitwiseXor() ????
should I put initial GetWindowLong() result in an instance variable and work on that one instead of doing everytime I change something a new getwindowlong() ???

Can I do an of_bitwiseAnd() to take away thick border???
Ain't "of_bitwiseOr()" the same as simply summing the values?? WS_THICKFRAME + WS_SYSMENU for example?

Thank you very much for your help if possible,

Miguel Leeuwe


regards,
Miguel L.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top