|
-
Mar 11th, 2001, 12:19 AM
#1
Thread Starter
Hyperactive Member
How Do You Center A Win32 Window ? I use borland c++, and do not use MFC, Pure API. Thanx. Please only reply if you really know how to center a win32 window. I'm sorry i had to post again, but somebody had replied to my other request thinking they knew and they really didn't. I mean no disrespect for the help offered by the other person, but i mean come on, if your gonna reply to someones question, at least by half sure and not just go out on a wimb. thanx 
AAG
-
Mar 11th, 2001, 07:56 AM
#2
Monday Morning Lunatic
Code:
RECT r, desk;
GetWindowRect(hWnd, &r);
GetWindowRect(GetDesktopWindow(), &desk);
int wa,ha,wb,hb;
wa = (r.right - r.left) / 2;
ha = (r.bottom - r.top) / 2;
wb = (desk.right - desk.left) / 2;
hb = (desk.bottom - desk.top) / 2;
SetWindowPos(hWnd, wb - wa, hb - ha, wa*2, ha*2);
I'm sure there are better ways...but I couldn't find anything automatic...I'm sure you can tidy this up a bit. It's not been tested, BTW
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Mar 11th, 2001, 12:45 PM
#3
Frenzied Member
I remember using somehting like WS_CENTERED....it is almost that...I'll look around for it.
-
Mar 11th, 2001, 02:14 PM
#4
I checked in MSDN and it was unlisted.
-
Mar 11th, 2001, 06:39 PM
#5
Frenzied Member
Yeah I could have sworn I saw it somewhere but can't find it...I guess there isn't any
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|