![]()  | 
 
CWindowRect() and Office/2007 theme. | 
 
    Post Reply  
   | 
  
| Author | |
   
   ddlittle  
   
   Senior Member  
   Joined: 19 February 2004 Location: United States Status: Offline Points: 132  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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 | 
 |
![]()  | 
 |
   
   ABuenger  
   
   Newbie  
    
   Joined: 02 February 2006 Status: Offline Points: 1075  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     Posted: 13 September 2010 at 3:17pm | 
 
   
   
 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
     
   
   | 
 |
![]()  | 
 |
   
   ddlittle  
   
   Senior Member  
   Joined: 19 February 2004 Location: United States Status: Offline Points: 132  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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 
    | 
 |
![]()  | 
 |
   
   cluster  
   
   Groupie  
   Joined: 22 January 2015 Status: Offline Points: 91  | 
  
   
      Post Options
    
        Thanks(0)
      Quote   Reply
   
     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?!  ![]() EDIT: I use Office2013 theme! 
    | 
 |
| 
   
     
     Windows 7 
   
  Visual Studio 2013 CodeJock 18.6  | 
 |
![]()  | 
 |
    Post Reply  
   | 
  |
|       
  
  Tweet   	
    | 
 
| Forum Jump | Forum Permissions  ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum  |