exact size of SDI main window

Hello.

how can I modify the size of my SDI main window to be exactly e.g.
768*1024 pixel? Should that be done in PreCreateWindow?

Until now I tried the following:

	RECT rect;
	rect.left = ::GetSystemMetrics(SM_CXSCREEN) / 4;
	rect.right = 1024;
	rect.top = ::GetSystemMetrics(SM_CYSCREEN) / 4;
	rect.bottom = 768;
	AdjustWindowRectEx(&rect, cs.style, TRUE, cs.dwExStyle);

       cs.cy = rect.bottom;
       cs.cx = rect.right;
       cs.y = rect.top;
       cs.x = rect.left;

	cs.style = WS_OVERLAPPED | WS_SYSMENU | WS_BORDER;
	cs.dwExStyle = WS_EX_RIGHTSCROLLBAR;
	if( !CFrameWnd::PreCreateWindow(cs) )
		return FALSE;
	return TRUE;

But still some parts of the image are not properly displayed, because
this code seems not to count for menu and tool bar.

Thanks for your help!
V.K.

0
1/22/2007 9:14:15 AM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
325 Views

Similar Articles

[PageSpeed] 21

I think the size does take into account the menu but not the toolbar.
Toolbar/StatusBar in MFC, actually is in client area of the window.
Essentially you will need to account for it in your calculations (ie
increase view  dimensions to include all CCOntrolBars).

--
Ajay Kalra [MVP - VC++]
ajaykalra@yahoo.com


"Verbal Kint" <TENSOAPFEN@gmail.com> wrote in message
news:1169457255.699470.68600@q2g2000cwa.googlegroups.com...
> Hello.
>
> how can I modify the size of my SDI main window to be exactly e.g.
> 768*1024 pixel? Should that be done in PreCreateWindow?
>
> Until now I tried the following:
>
> RECT rect;
> rect.left = ::GetSystemMetrics(SM_CXSCREEN) / 4;
> rect.right = 1024;
> rect.top = ::GetSystemMetrics(SM_CYSCREEN) / 4;
> rect.bottom = 768;
> AdjustWindowRectEx(&rect, cs.style, TRUE, cs.dwExStyle);
>
>        cs.cy = rect.bottom;
>        cs.cx = rect.right;
>        cs.y = rect.top;
>        cs.x = rect.left;
>
> cs.style = WS_OVERLAPPED | WS_SYSMENU | WS_BORDER;
> cs.dwExStyle = WS_EX_RIGHTSCROLLBAR;
> if( !CFrameWnd::PreCreateWindow(cs) )
> return FALSE;
> return TRUE;
>
> But still some parts of the image are not properly displayed, because
> this code seems not to count for menu and tool bar.
>
> Thanks for your help!
> V.K.
>


0
ajaykalra (6842)
1/22/2007 3:09:38 PM
"Verbal Kint" <TENSOAPFEN@gmail.com> wrote in message 
news:1169457255.699470.68600@q2g2000cwa.googlegroups.com...
> Hello.
>
> how can I modify the size of my SDI main window to be exactly e.g.
> 768*1024 pixel? Should that be done in PreCreateWindow?
>

You're almost there!  Use AdjustWindowRect() to account for the toolbar and 
menu.

-- David (MVP)


0
dc2983 (3206)
1/22/2007 3:10:25 PM
Reply:

Similar Artilces:

Money 2004 Std w/ Windows 7
After restoring my Money 2004 files from my backup copy onto my new PC w/Windows 7, my Money password is not recognized. I cannot access 7 years worth of Money files. Is there a means to correct this so my password will be recognized? Thanks! In microsoft.public.money, Ty58 wrote: >After restoring my Money 2004 files from my backup copy onto my new PC >w/Windows 7, my Money password is not recognized. I cannot access 7 years >worth of Money files. >Is there a means to correct this so my password will be recognized? Thanks! The most common thing with a situatio...

Outlook Crashes when Opening Calendar/Inbox in New Window
The Outlook crashes whenever I tried to open another instance of outlook, or right-clicking on Calendar/Inbox and then clicking "open in new window". It will just exit without giving any error messages. And, it was working well previously! Please advise me, thank you! ...

how do I remove messages from welcome window
When I turn on my computer my welcome screen shows that I have messages, but when I go to my outlook there are none. I then check my comcast mail and there are no messages there either. I still do get messages but after i've read them my welcome screen still shows I have messages. http://www.outlook-tips.net/howto/winxp_unread.htm -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Need Help with Common Tasks? http://www.outlook-tips.net/beginner/ Outlook Tips: http://www.outlook-tips.net/ Out...

What is the Contacts field used for in the task window?
At the bottom of the window, there is a field for CONTACTS. I have no idea what this field is used for? It's used to indicate any contacts the task may be associated with. "tarrykin" <tarrykin@discussions.microsoft.com> wrote in message news:6114F8DC-67F0-4F3B-AC73-14BC8012ECA6@microsoft.com... > At the bottom of the window, there is a field for CONTACTS. I have no idea > what this field is used for? ...

How can I make Lexmark Z23 print with Windows 7
When I press "print" the print panel quickly fills to 99% but does not continue and does not print. How can I fix this? You may need an updated printer driver from Lexmark. -- Stefan Blom Microsoft Word MVP "William" <William@discussions.microsoft.com> wrote in message news:2749CD95-028E-4088-A633-5F265CC18938@microsoft.com... > When I press "print" the print panel quickly fills to 99% but does not > continue and does not print. How can I fix this? ...

Information Store and size question
Hey all...some basic questions for you all. I hope someone can help! 1. What's the difference between the private information store and the public information store? 2. Combined, are these two store the total size of the mail database? 3. How do I tell the total size of all my Public Folders? Thanks! This is on Exchange 2003 Standard with SP2. Private Information store contains all the data from all your users' mailboxes...Public Iinformation store contains all the data in your Public Folders...to find the size of all your Public Folders, add together the pub.edb and pub.stm.....

form size upon opening?
How do I control the size of forms when they are opened ... I seem to not correctly understand how to set all my forms to the size I want them to be when they are opened. I always seem to have to change them. Suggestions please ... Bob Hi Bob, When you open your database the form should open to the same size every time. However, if you are referring to the size when you are working on the form and the size when a user opens it, you may have a command that is maximizing this. If you remove it, what ever size you make it in design view will be the same size when the user opens it. "...

how do I open Zero Wireless Configuration (WZC) window ?
Hi, How do I open the ZWC window from my application ? I would like to open the window from my application (even through cmd) so the user will be able to choose the network he/she wants. Im using wlan api (winxp.sp2). Thanks. Bamba. I'm not sure what this window is, but if you can describe how you open it normally it might be possible to figure out what to actually execute to bring it up programmatically. joe On Sun, 7 Oct 2007 04:57:54 -0700, Bamba <Bamba@discussions.microsoft.com> wrote: >Hi, > > How do I open the ZWC window from my application ? > I woul...

Problema com PRINTER no windows
Ol� N�o consigo imprimir a partir de dois postos de trabalho XP PRO para uma impressora de rede (ethernet): o status da PRINTER no windows indica o estado OFFLINE; curioso � que quando reinicio o servi�o de SPOOL do windows esta fica ONLINE por alguns segundos, sendo possivel imprimir; depois volta a ficar offline. Ao realizar um ping continuo ao IP da impressora verifico que n�o existe quebra de rede, por isso calculo que seja um problema do windows. Os postos est�o actualizados.......... Alguem j� teve este problema? existe algum HOTFIX? P.S-Coloquei a impressora ligada...

Running dos scripts on WIndows 2003 64 bit OS
This is a naive question. I have read that Windows 2003 64 bit does not support dos application which is probably 16bit. I have several batch scripts written using dos commands. I think dos commands are still supported in WIndows 64 but using some 32 bit API or 64bit API, but not 100% sure. I will be really surprised if batch scripts containing dos commands will stop working on 64 bit WIndows OS. I do not have a 64bit Windows OS yet, looking into getting it installed. It sounds like you are confusing the term "Dos application" and the windows command prompt. The com...

Subform Equals Main Form
I have a main form called frmcharges. I also have sub form in datasheet view called frmChargesSub. In Both forms I have a combo Box called CmbDx1. What I want to do is when I enter something in DX1 on the frmcharges it will automatically put it into the field in my frmChargesSub. I Thanks In Advance I can't tell from your description what it is in the underlying table(s) that you are trying to store via your main form AND your subform. Usually, there wouldn't need to be the same value stored redundantly (except for the primary key/foreign key. What are you trying to accomplish? ...

How to change maximum 'send' size ? Exch2003
I go to ESM, Global Settings. On "Message Delivery", I click Properties. I select "Default" tab. I see that "Sending message size" = 10240. I need to send a 22MB file as an emergency. I change that value temporarily to 24000. I attempt to send the e-mail with the 22MB attachment and I've got to the message below. What am I msising here ? (the recipient claims that his mailbox isn't full)' Your message did not reach some or all of the intended recipients. Subject: FW: -A75E-B441B4AB3E32}:MRC The following recipient(s) could not be reached: user@gi...

IE Problem related to Windows Live
I uninstalled the Windows Live programs yesterday, and now Internet Explorer will not connect to the internet. Message says "not responding." I tried to download and reinstall IE8, but the installation will not complete because it says I have a "more recent version" already installed. I also cannot uninstall IE, because it does not show up on the programs list on the Control Panel. I'm running Vista with all updates current. Any help will be appreciated. Always state your full Windows version (e.g., Vista SP1; Vista 64-bit SP2) when posting in a for...

Row and Column Headers
I am sorting out all my workbooks.. I've noticed that some workbooks have different sized fonts for the Row and Column headers.. the A,B,C,D.. and 1,2,3,4,5...etc, etc.. Where or how am I able to change the size and type of font for this? I've looked everywhere I can think of. Many thanks in advance Bill, Format menu | Style | Normal (in drop down box) | Modify Regards, Jim Cone San Francisco, CA "Bill" <anonymous@discussions.microsoft.com> wrote in message news:05c101c3cdaa$78f6f210$a001280a@phx.gbl... > I am sorting out all my workbooks.. I've notic...

Windows Security and CD
hi, I want to ask two that what is better and what should I install, "Windows Defender" or "Windows security essential" or should I've to install the both. kindly reply on my email preferably or any other mean. Submitted via EggHeadCafe - Software Developer Portal of Choice SQL Server Stored Procedures Passing Arrays http://www.eggheadcafe.com/tutorials/aspnet/d066dd93-c778-4cee-8c6d-65d50b2199b3/sql-server-stored-procedu.aspx If I have Microsoft Security Essentials do I still need Windows Defender? Microsoft Security Essentials is a free download for h...

Windows XP blue screen
I have a Dell laptop latitude and have the blue screen of death as I have found on the web it is called. I can't seem to find the error by searching on the web that I have on my computer. I have the following error: STOP: 0x0000007e (0xc00000005, 0x805d2018, 0xf9e513e4, 0xf9e510e0) I read where a lot of the errors say something after but mine does not. Thanks to any help in advance!! -- wevie ------------------------------------------------------------------------ wevie's Profile: http://forums.techarena.in/members/159022.htm View this thread: http://forum...

Windows Media Player won't play ANY music it played yesterday
As of this morning, none of my music will play. I'm using Windows 7. I haven't done anything between today and yesterday that I can think of which may have resulted in Worked fine yesterday and it will work using my HP Media Player. I haven't installed any new programs or music recently. Online help related to the error message wasn't applicable for what mine is doing... Here's the error message: Windows Media Player cannot play the file. The Player might not support the file type or might not support the codec that was used to compress the file. What&...

Exchange CLusters on Windows Storage Server devices
We are considering Exchange clusters. I see that Exchange now supports having it's databases on Windows Storage Devices. Looking thorugh the HCL, though, I haven't seen any specific recommended configs with this. Has anyone implemented these? Is it ready for prime time, or should we wait for Service Pack 3? Any feedback appreciated.... ...

Unable to Send text message to child window
hi, From My MFC Application I create a modless window on the click of a button. From the same clicking function I assign a value to an edit box( CString value). CTestModless *p; p = new CTestModless; p->Create (CTestModless::IDD, GetDesktopWindow()); CRect rSize ; p->GetWindowRect(&rSize); p->MoveWindow(10,10, rSize.Width(), rSize.Height()); p->ShowWindow(SW_SHOW); GetDlgItem (IDC_BUTTON2)->EnableWindow(FALSE); p->ShowWindow(SW_SHOW); p->m_strD1Bc1 = "123"; p->UpdateData(FALSE); But it is giving an error telling there is some problem o...

Adjust size of barchart, scale
My problem is that I have a barchart that displays percentages by mont and one month houses 80% of the activity while all the other month only have 2-5% of activity. The 1 month rerally sticks out on the barchart and the other months ar much much smaller..you can't see the detail on them. is there any way to break the 1 month barchart down? I have seen chart with squiggly lines before that indicate that the chart is out of th plotting area. I want the plotting area to max out at 5% but still show the outlie month, just with scaled down significantly. How can I do that? Any help would be ap...

Wizard Application
Hi All, I have a Wizard Application which has three Property Sheet and Each of Different size and 1st page has only 3 radio button and so I need the fonts of this page to be much bigger but second & third page has lot of contents so i cannot use the same font in all page & will be using default fonts size. How Dyamically changing the font on a Wizard Application. 1) Is it Possible to Resize the window for each page with respect to its size in wizard appln. 2) How to dymanically create a font and write the static text in wiz app. Appriciate you to come back to me at the earliest and ...

CDONTS on Windows 2003 Server
I am in the process of moving all my web applications from a windows 2000 server (IIS) to a windows 2003 server (IIS). I have apps written in VS6, .net and .net2002 but i am having problems with my VS6 applications, when they try to run the following code: Set objMsg = Server.CreateObject("CDONTS.NewMail") Is there anyway to install CDONTS on a windows 2003 server? I can't get debugging to work on the new server so I can't give you an exact error message... just that when I rem out that line... the program works fine. Any thoughts BESIDES rewriting my code in .NET? Than...

Pop-up block opening an activity window
Hi, I have a user who is not able to create a new activity. It seems to be a Pop-up block issuem but Pop-up blocker is turn off. Anyone has an idea on what could cause that? Thanks for your help. Valerie ok, find out he had a google toolbar htat blocked it. "Val" wrote: > Hi, > > I have a user who is not able to create a new activity. It seems to be a > Pop-up block issuem but Pop-up blocker is turn off. Anyone has an idea on > what could cause that? > > Thanks for your help. > > Valerie ...

Windows PowerShell 1.0
Hi: Today I noticed a new program called Windows Powershell 1.0 had installed on my PC. I cannot uninstall it from "Add or Remove Programs" because it's not shown there. Neither is it shown in "Windows Installer Cleanup". Is it possible to remove this program and if so, how? I appreciate any advise. Thanks, Fred fwall4 wrote: > Hi: Today I noticed a new program called Windows Powershell 1.0 had installed > on my PC. I cannot uninstall it from "Add or Remove Programs" because it's > not shown there. Neither is it shown in "Windo...

Windows XP x64 MFC application problem
I can't start my application on Windows XP Prof. 64-bit wersion, there is messagebox "Failed to create empty document". Application works fine on Windows 2000 SP4 and Windows XP Prof. SP2. What can I do to solove this probem? >I can't start my application on Windows XP Prof. 64-bit wersion, there is >messagebox "Failed to create empty document". Application works fine on >Windows 2000 SP4 and Windows XP Prof. SP2. What can I do to solove this >probem? The obvious response is - try debugging it on that platform and find where it's giving rise ...