Print Page | Close Window

CWindowRect() and Office/2007 theme.

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=17240
Printed Date: 25 April 2024 at 7:09pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CWindowRect() and Office/2007 theme.
Posted By: ddlittle
Subject: CWindowRect() and Office/2007 theme.
Date 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



Replies:
Posted By: ABuenger
Date 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


Posted By: ddlittle
Date 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


Posted By: cluster
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net