INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

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

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

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

(OP)
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.

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

Maybe you can use the GetWindowLong / SetWindowLong API combination.

My blog entry on them
http://anvil-of-time.com/wordpress/powerbuilder/po...

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
http://msdn.microsoft.com/en-us/library/windows/de...

Matt

"Nature forges everything on the anvil of time"
www.anvil-of-time.com

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

(OP)
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.

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

(OP)
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.

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

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"
www.anvil-of-time.com

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

(OP)
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.

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

(OP)
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.

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

(OP)
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:
  • in resize event check if sizetype indicates 'restore' or 'maximize' of the window
  • in resize event when restoring: apply thickFrame
  • in resize event when maximizing: take away - thickFrame
-

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.

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

(OP)
Okay I did it finally!

regards,
Miguel L.

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

Can you share what you finally did to get things working?

Thanks

Matt

"Nature forges everything on the anvil of time"
www.anvil-of-time.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close