Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CWindowRect() and Office/2007 theme.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CWindowRect() and Office/2007 theme.

 Post Reply Post Reply
Author
Message
ddlittle View Drop Down
Senior Member
Senior Member


Joined: 19 February 2004
Location: United States
Status: Offline
Points: 132
Post Options Post Options   Thanks (0) Thanks(0)   Quote ddlittle Quote  Post ReplyReply Direct Link To This Post Topic: CWindowRect() and Office/2007 theme.
    Posted: 13 September 2010 at 12:43pm
When my app exits, I write the window rect to the registry, and when it starts, I get that value in PreCreateWindow() and set the window locations, so that the app appears in the same location and size as where it was when it exited.  The problem is when I use the Office/2007 and black theme (from Vista.cjstyles), GetWindowRect() is a couple of pixels smaller than the window, so the window shrinks a little.  We noticed that the difference was 4 pixels, so we arbitrarily added 4 to the height, which I think is a hack.  Is there an XTP equivalent that will do the same thing, similar to GetSystemMetrics(SM_CXFRAME) or something?
 
Here's my code:
 

CRect r;

GetWindowRect(&r);

CString s;

s.Format("%d,%d,%d,%d", r.left,r.top,r.Width(),r.Height()+4); //5.20b correct shrinking window

AfxGetApp()->WriteProfileString("Location","Frame", s);

Thanks!
- David
Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post Posted: 13 September 2010 at 3:17pm
Originally posted by ddlittle ddlittle wrote:

s.Format("%d,%d,%d,%d", r.left,r.top,r.Width(),r.Height()+4); //5.20b correct shrinking window


A little off topic, but your comment tells me that you are not using version control. Suchs comments do not belong into the code.

Codejock support
Back to Top
ddlittle View Drop Down
Senior Member
Senior Member


Joined: 19 February 2004
Location: United States
Status: Offline
Points: 132
Post Options Post Options   Thanks (0) Thanks(0)   Quote ddlittle Quote  Post ReplyReply Direct Link To This Post Posted: 13 September 2010 at 4:33pm
Yes, we use version control - we use TFS, and our server is somewhere in the cloud in a level 3 server farm.  We just have some old school guys that pre-date version control (and Windows) who like to leave little remarks.  It's harmless (occasionally helpful) and not worth the 'religious' war I'd start if I tried to get them to change.  I prefer Araxis Merge and "View History" if, on that rare occasion, I need to see what changed version to version.   You can tell that it's an old-school guy from the question, though, because nobody else would just add an arbitrary number as a 'fix', either.
 
Anyway, any ideas about the 'real' problem?
 
- David
Back to Top
cluster View Drop Down
Groupie
Groupie


Joined: 22 January 2015
Status: Offline
Points: 82
Post Options Post Options   Thanks (0) Thanks(0)   Quote cluster Quote  Post ReplyReply Direct Link To This Post Posted: 05 March 2020 at 12:21pm
Hi,

I have the same problem, plus a 8 pixel different in the width .
I have no idea where this comes from?! Confused

EDIT: I use Office2013 theme!
Windows 7
Visual Studio 2013
CodeJock 18.6
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.078 seconds.