difference between window dimensions and window client area dimensions

I need to find the difference between window dimensions and window
client area dimensions for an SDI application.  Currently I'm using
the brute force method:

		CRect clientRect;
		GetClientRect(&clientRect);

		CRect mainRect;
		GetWindowRect(&mainRect);

		int frameExtraX = mainRect.Width() - clientRect.Width();
		int frameExtraY = mainRect.Height() - clientRect.Height();

This is ugly and doesn't always work, so I would like to get
frameExtraX and frameExtraY from some kind of system metrics values.

Thank you!
0
7/27/2003 4:27:27 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
897 Views

Similar Articles

[PageSpeed] 36

You've already said the magic words "system metrics".  Have you not 
looked at the GetSystemMetrics function with parameters such as 
SM_CXSIZEFRAME and SM_CYSIZEFRAME?

In article <f6d18f89.0307270827.5961ec40@posting.google.com>, danny wang 
says...
> I need to find the difference between window dimensions and window
> client area dimensions for an SDI application.  Currently I'm using
> the brute force method:
> 
> 		CRect clientRect;
> 		GetClientRect(&clientRect);
> 
> 		CRect mainRect;
> 		GetWindowRect(&mainRect);
> 
> 		int frameExtraX = mainRect.Width() - clientRect.Width();
> 		int frameExtraY = mainRect.Height() - clientRect.Height();
> 
> This is ugly and doesn't always work, so I would like to get
> frameExtraX and frameExtraY from some kind of system metrics values.
0
7/27/2003 6:49:11 PM
Scot, 

I spent hours trying to get the result I need playing with
::GetSystemMetrics().
I tried different combinations of SM_CYSIZE, SM_CYMENU, SM_CXSCREEN
and so on before posting the question.

This is one of those things that seems very easy on the surface, yet
impossible to solve.

Scot T Brennecke <ScotBspamhater@MVPs.org> wrote in message news:<MPG.198dda9e1dc7b2f0989b75@msnews.microsoft.com>...
> You've already said the magic words "system metrics".  Have you not 
> looked at the GetSystemMetrics function with parameters such as 
> SM_CXSIZEFRAME and SM_CYSIZEFRAME?
> 
> In article <f6d18f89.0307270827.5961ec40@posting.google.com>, danny wang 
> says...
> > I need to find the difference between window dimensions and window
> > client area dimensions for an SDI application.  Currently I'm using
> > the brute force method:
> > 
> > 		CRect clientRect;
> > 		GetClientRect(&clientRect);
> > 
> > 		CRect mainRect;
> > 		GetWindowRect(&mainRect);
> > 
> > 		int frameExtraX = mainRect.Width() - clientRect.Width();
> > 		int frameExtraY = mainRect.Height() - clientRect.Height();
> > 
> > This is ugly and doesn't always work, so I would like to get
> > frameExtraX and frameExtraY from some kind of system metrics values.
0
7/28/2003 7:27:42 PM
Joe, thanks for the idea!  CalcWindowRect() _almost_ does the job. 
The problem is that I need to perfectly fit bitmap into the client
area.  Things like toolbars, status bars, various skins should be
taken into account.

For now, it looks like I will stick with the ugly code that I posted
in my original message.  It gives the exact result.


Joseph M. Newcomer <newcomer@flounder.com> wrote in message news:<g42civ8o260jio7c4hmfudjese8s1has0d@4ax.com>...
> I addition to the other answers you have been given, look at CalcWindowRect. Given a
> desired client size, it will give you the window size  you need, given the current window
> styles, or, alternatively, given a window size, it will tell you waht the client size will
> be.
> 				joe
> 
> On 27 Jul 2003 09:27:27 -0700, dannywang90@yahoo.com (danny wang) wrote:
> 
> >I need to find the difference between window dimensions and window
> >client area dimensions for an SDI application.  Currently I'm using
> >the brute force method:
> >
> >		CRect clientRect;
> >		GetClientRect(&clientRect);
> >
> >		CRect mainRect;
> >		GetWindowRect(&mainRect);
> >
> >		int frameExtraX = mainRect.Width() - clientRect.Width();
> >		int frameExtraY = mainRect.Height() - clientRect.Height();
> >
> >This is ugly and doesn't always work, so I would like to get
> >frameExtraX and frameExtraY from some kind of system metrics values.
> >
> >Thank you!
> 
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
0
7/30/2003 2:40:07 AM
Scot, thanks again for your help. 

> Is your problem mostly with the width, the height, or both?  

Both the width and the height should fit perfectly (the client area
has a bitmap background).

> Are you 
> perhaps making the calculations too soon, before things like toolbars, 
> menus, scrollbars, etc. have modified the size of the client area?
> 

Timing is not a problem.  

Toolbar and menu dimensions are dynamic because the window has many
skins available.

I just tried CalcWindowRect(), but it looks like it has no idea about
the actual toolbar/menu/status bar dimensions.

Time to give up. MFC wins again ;-)
0
7/30/2003 2:50:32 AM
Reply:

Similar Artilces:

Pulling data daily from a differently named report everyday
Hello, I have a spreadsheet where I use formulas to pull data from multiple reports on a shared server everyday. What I do is to save those reports under a certain name everyday since the formulas have to have the static report name in them to pull data. (For example, A1 may pull data from c:\reportfolder\reportA, B1 may pull from c: \reportfolder2\reportB, etc). In these report folders our IT group runs a new report in it everyday but of course they change the name of the report every day (to reflect the date) . . so in the reportfolder there will be "reportA-3-12-2009", and "...

Different margins on different pages
I am setting up a template for letters at work. The first page of our letterhead has one ste of margins and all subsequent pages will have a different sent of margins. I know that section breaks can be used, but if staff copy and paste text from existing letters into this new template, the section break moves. Is there any way of locking the section break to the page? so the pasted text goes over the top of it? Hi Lilly80, You could setup your document with a 'different first page' layout. That allows the first page to have a different set of margins to the rest o...

DPM 2010 RC Agent Install on Windows 2008 Server R2
We are having trouble installing the DPM agent on a Windows 2008 Server R2 machine used as a terminal server. Any time we try to install from the DPM Console, we get the following error: "The agent operation failed because an error occured while running the installation program. Error details: Unspecified error (0x80004005)" If we install manually, the agent installs, but we get this same error when we try to set the DPM server using SetDPMServer.exe. I successfully installed this Agent on a Server 2008 R2 Terminal Server (Remote Desktop Session Host) using DPMAgent...

Windows Mail
I can receive mails without problem but suddenly - from about mid-day today I can no longer sent them. If I go to the website of my ISP, I have no trouble sending them. The error message I get is : An unknown error has occurred. Subject 'Return of Card', Account: 'E-Mail do SAPO', Server: 'smtp.sapo.pt', Protocol: SMTP, Port: 25, Secure(SSL): No, Error Number: 0x800CCC0B. Any help/suggestions much appreciated ! Jack "Unknown error" can be caused by interference from an antivirus=20 program. Which antivirus are you running? As a minimum, email ...

Two RPC over HTTPs clients one connects the other can't
Hello, I have two RPC over HTTPs clients - both going through the same router. One connects the other cannot. The one that cannot was only using windows firewall and I've turned it off and it still cannot connect. If I use a vpn client to our server it connects fine. I can't figure out why one works without the vpn client and the other doesn't. Any guesses? Thanks Check the client AV Firewall on the computer. Trend Micro, Symantec now include the firewall with AV client. If everything checks OK, try opening outlook at a run command with outlook /rpcdiag. What hap...

Microsoft will be disabling all Windows prior to Vista
On June 1, 2010. Microsoft will be disabling the operating systems from ALL computers worldwide, if the operating system was created prior to Windows Vista. This includes anyone using Windows 3.x, Win95, Win98, WinME, and Windows XP. It includes all original or upgraded versions, such as XP or XP-SP3. If you are using any of these operating systems, they will be disabled on your computer on this date. Only persons using Windows Vista and Windows 7 will be able to continue using their computers. When Windows is disabled, none of you personal data will be removed or destroyed. Yo...

Different values for error bars in series
In Excel 2007, how do you put in different error bar values for each data point in a series? So far I am only able to put in one value for all in my bar chart. Hi, See Jon's blog on the subject. http://peltiertech.com/WordPress/error-bars-in-excel-2007/#comments Cheers Andy On 06/04/2010 15:52, wdwind1 wrote: > In Excel 2007, how do you put in different error bar values for each data > point in a series? So far I am only able to put in one value for all in my > bar chart. -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info ...

outlook contains transfering after a windows crashed
How to process for recover the contains of all the outlook contains in my different mail boxes after a non correct operation on a window98 PC. that is to says , it's for me now impossible to open outlook because all the EXEC in my PC doesn't work, i'm only able to see , througt the work area, the contains of all the folders ,so possible to copy with a disquette...sorry if my english is bad but i'm french. Before reformat all ,i will be interested to recover my outllok's contains, this il my main problem. Many thank's You mention your folders which leads me to believe...

A Different CRM for GP
Hello, We are pondering the idea of implementing MS Dynamics CRM. However, I am curious whether anyone else has had success in integrating a different CRM product with GP 10.0. It's not that we don't like the MS product; I just like to ensure I have covered all bases. Our partner does not have any other recommendations as they have not worked with any other CRM applications. Any information would be greatly apprecaited. Thank you, -- Jessie GoldMine is a good product, very mature, and easier to maintain table structures. There are links to GP but I cannot remember the fir...

CRM Small Business Edition running on Windows 2003 Server.
Hi all I would like to know if MS CRM Small Business edition will run on a standard Windows 2003 Server. I have SQL 2000 installed and running on a seperate server and could install SQL 2005 on another server if required. Any ideas as to getting CRM small business to run w/o installing Windows 2003 Small Business Server would be extremely appreciated. Thanks In Advance. Mark S. Mark, CRM 3.0 SBE will only install in Small Business Server. Mitch To my knowledge this cannot be done due to licence restrictions. To use the SBS edition of CRM it needs to run on SBS. The only possibili...

Windows 7 Upgrade from XP Pro IE 8 Certificate Errors
My PC was recently upgraded from XP Pro to Windows 7 Pro. I had IE 8 before on XP, but now I am getting certificate errors for many of the sites that I regularly visit including our companies own intranet site, google mail, several financial institutions websites, etc. I know these sites are safe, but I cannot figure out what the upgrade process has done to my system to cause me to get these certificate errors. I have spent much time googling, and tried many different IE setttings, double checked the date time setting on my machine etc. all to no avail. PLEASE HELP!!! Below ...

2 users access calendar online with different rights
hi user A wants to give user B permission to see, add and edit entries in calendar online http://www.exchangedomain.ch/usersname/kalender/ user B is able to see, but not to add or edit entries at the moment in outlook itself its working. user B can open the folder calendar of user A and make entries and change entries what have to be done that this is possible also with web access exchange ? thankx mike schwarz On Thu, 26 Oct 2006 14:09:29 +0200, "Mike Schwarz" <ctek@ctek.ch> wrote: >hi > >user A wants to give user B permission to see, add and edit entries in &...

Windows Services #3
I want to provide a windows service. And then I want to write an application so that interact with this windows service. notice: I want to do these work in C++6.0 not in .NET Framework -- Mojtaba ------------------------------------------------------------------------ Posted via http://www.codecomments.com ------------------------------------------------------------------------ ...

Same column, different cell width at different row
I have tried inserting a break and split, didn't work. I just want to separate the top half of a page with the bottom half so I can apply different cell width on the same column. Or how would I be able to do this? Same column but different cell width. Thanks! Glenn You can't do that. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Glenn Chung" <GlennChung@discussions.microsoft.com> wrote in message news:20746997-9D99-4684-A352-120370D27036@microsoft.com... >I have tried inserting a break and split, di...

Fixed Assets
When using the Fixed Asset module, I am finding some small differences when compared to the Depreciation calculated by the External Accountants for tax purposes. Client would like to match exactly to the amounts calculated by external accounts. What is the best way to fix this issue? thanks, -- Patti Need more info Patti. What are the depreciation methods/settings that are creating the differences? Does this occur on every asset or just some? Frank Hamelly MCP-GP, MCT, MVP East Coast Dynamics www.eastcoast-dynamics.com get your gptip42today at www.gp2themax.blogs...

Windows Mail/Comcast Error Message
The connection to the server has failed. Account: 'mail.comcast.net', Server: 'mail.comcast.net', Protocol: POP3, Port: 110, Secure(SSL): No, Socket Error: 10060, Error Number: 0x800CCC0E I've been timing out for months and since I primarily use my Crackberry, I haven't been too concerned. Now, I'm annoyed and needing incoming and outgoing emails on my computer more often than once every 10 times I open or synchronize. What's the deal? OK, It's my Antivirus software (Webroot). Is it safe to forego the email attachments shield? This must ...

Dates Difference
Hi, I need to get the difference between 2 dates (in number of days), how do i get that in vc++? I have used the DateDiff function in asp but couldn't find anything like that. Also, how can i convert string to a date? thanks in advance karan >I need to get the difference between 2 dates (in number of days), how >do i get that in vc++? Karan, Convert (if the dates aren't already in this format) the dates/times to FILETIME and subtract the values. >Also, how can i convert string to a date? Try COleDateTime::ParseDateTime or VarDateFromStr. Dave -- MVP VC++ FAQ: http://ww...

Want to display value and difference on one chart
I am trying to create a chart that displays x and 10-x on the same chart. I want the chart to show a meaured value and the difference of that value to 10 in a different color. On Wed, 6 Aug 2008, in microsoft.public.excel.charting, JMH <JMH@discussions.microsoft.com> said: >I am trying to create a chart that displays x and 10-x on the same chart. I >want the chart to show a meaured value and the difference of that value to 10 >in a different color. Use your spreadsheet to calculate the values, then use the chart to graph them. Never try to use a chart for calculation. ...

Windows e-mail
Is it possible to include BCC (blind copy) when I send an email? I only see To: and CC: This newsgroup is intended for questions about Access, the database product that's part of Office Professional. Are you trying to send e-mail using Access? If so, are you using the SendObject command (which does support bcc), or are you using some other approach? If you're not using Access, I'd suggest reposting your question to a newsgroup related to whatever e-mail client you're using. I see that this question was posted using Windows Mail, so you may want to check out microsof...

Sending from 2 different computers
I have Outlook 2003 on my desktop at home and 2002 on my laptop while traveling. My server is Comcast. I would strongly prefer to use Outlook (rather than Comcast's webmail) on both computers. I have configured Outlook on both computers to receive email. I can also leave a copy on the server so it can be downloaded again later on the other computer, assuring that I always have copies of all emails no matter which computer I'm using. Problem is I can't send from my laptop. I've tried Comcast's instructions for configuring Outlook 2002 for use while traveling, but it doesn&...

Where is Outlook Express in Windows 7?
Hi, I just purchased a computer with Windows 7. I went to Start-->All Programs, and can't find OE on the menu. Is there OE in Windows 7? Please help, thanks in advancel. The last Windows version that had OE was XP. Win7 does not come with any e-mail client. If you want to stick with an MS client, Windows Live Mail is the successor to OE and Windows Mail (Vista). Windows Live Mail (Overview, Features & Download): http://get.live.com/wlmail/overview -- Bruce Hagen MS-MVP [Mail] Imperial Beach, CA "sheana" <sheana@discussi...

Different shape width in different views in Excel 2007??
In Excel 2007, I create a shape in "Normal" view and set its width to any value (e.g. to 15cm). Now I change to "Page Layout" view and guess what... the width now shows up as something more than 16cm??! (The width property as points in VBA changes accordingly.) Switching to "Page Break View" will result in one more different width value. Is this "just" a big bug in Excel 2007 or did I miss something?? I know that the selected default printer or the chosen zoom factor may have an influence on the shown size of a shape, but these discrepancies are ...

appointment prints different time
Hi, My client uses a french CRM with date format dd/mm/yyyy. when he creates an appointment with the SFO client from e.g. 11 o'clock until 16 o'clock it is saved like correctly. but when he prints it out, the starttime is 8 o'clock and end time 13 o'clock. it is like that for every appointment. it always prints out 3 hours earlier. Anybody had this too? Thanx Cypress, You can check if both the server and the user are in the same time zone. Server: Open Control Panel, Date and Time, Timezone Client: On the laptop open Control Panel, Date and Time, Timezone Open CRM vi...

Different Columns on different pages
Hi - think this will be easily resolved but I am stuck! In publisher 2000 how do you create a multipaged, two page spread that has different columns on some pages. I keep bringing myself back to "ignore background" and trying to use "arrange" - "layout Guides" - but this isnt right. Am I thinking too deep? Is the whole point that the layout guides are simply guides and stay the same thorugh the whole document regardless.... you just use ruler guides to make the changes through the different pages? Any idea's? Thanks Julia ...

Difference 05-21-04
What is the difference between CRM standard and professional? -Johnny Johnny wrote: > What is the difference between CRM standard and professional? > > -Johnny Does it have anything to do with Outlook integration? -- - I am Johnny! Your Internet penpal. I have a scooter, how about you? "Johnny" <alphascooter-verizon@yahoo.com> wrote in message news:evfBJNwPEHA.3708@TK2MSFTNGP10.phx.gbl... > Johnny wrote: > > > What is the difference between CRM standard and professional? > > > > -Johnny > Does it have anything to do with Outlook inte...