MFC SDI initial frame size

How can I override the width & height values that my SDI app uses at run 
time? I tried modifying lpCREATESTRUCT but it ignores my changes ( or at 
least it seems to ). OR better yet how can I have it remember the last size 
when closed?

-- 

Ron H
-- 
This outgoing email was scanned by
Norton Antivirus Corp. Edition
and found to be virus free! 


-----------------
www.Newsgroup-Binaries.com - *Completion*Retention*Speed*
Access your favorite newsgroups from home or on the road
-----------------
0
rnharsh1 (20)
7/29/2008 10:33:31 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
566 Views

Similar Articles

[PageSpeed] 19

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
     cs.style |= WS_CLIPSIBLINGS|WS_CLIPCHILDREN;
     cs.hMenu = NULL;
     cs.style &= ~FWS_ADDTOTITLE;
     cs.style &= ~WS_VISIBLE; // make window invisible at first.

     //ensure width never less than 800 x 600;
     if(IsMinimumScreenRes())
     {
          cs.cx = 800;
          cs.cy = 600;
     }

      if( !CFrameWnd::PreCreateWindow(cs) )
          return FALSE;

     return TRUE;
}

bool CMainFrame::IsMinimumScreenRes()
{
    bool bIsMin = false;
    int width = GetSystemMetrics(SM_CXSCREEN);
    int height = GetSystemMetrics(SM_CYSCREEN);
    //Ensure width never less than 800;
    if(width <= 800 && height <= 600)
        bIsMin = true;
    return bIsMin;
}

Tom
"Ron H" <rnharsh@nospam.net> wrote in message 
news:488f606e$0$13850$8d2e0cab@news.newsgroup-binaries.com...
> How can I override the width & height values that my SDI app uses at run 
> time? I tried modifying lpCREATESTRUCT but it ignores my changes ( or at 
> least it seems to ). OR better yet how can I have it remember the last 
> size when closed?
>
> -- 
>
> Ron H
> -- 
> This outgoing email was scanned by
> Norton Antivirus Corp. Edition
> and found to be virus free!
>
> -----------------
> www.Newsgroup-Binaries.com - *Completion*Retention*Speed*
> Access your favorite newsgroups from home or on the road
> ----------------- 

0
tom.nospam (3240)
7/30/2008 12:10:20 AM
Also, in terms of resetting the original size, GetWindowPlacement/SetWindowPlacement; I
have primitives in my Registry library for saving window placement information and
restoring it.
				joe

On Tue, 29 Jul 2008 17:10:20 -0700, "Tom Serface" <tom.nospam@camaswood.com> wrote:

>BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
>{
>     cs.style |= WS_CLIPSIBLINGS|WS_CLIPCHILDREN;
>     cs.hMenu = NULL;
>     cs.style &= ~FWS_ADDTOTITLE;
>     cs.style &= ~WS_VISIBLE; // make window invisible at first.
>
>     //ensure width never less than 800 x 600;
>     if(IsMinimumScreenRes())
>     {
>          cs.cx = 800;
>          cs.cy = 600;
>     }
>
>      if( !CFrameWnd::PreCreateWindow(cs) )
>          return FALSE;
>
>     return TRUE;
>}
>
>bool CMainFrame::IsMinimumScreenRes()
>{
>    bool bIsMin = false;
>    int width = GetSystemMetrics(SM_CXSCREEN);
>    int height = GetSystemMetrics(SM_CYSCREEN);
>    //Ensure width never less than 800;
>    if(width <= 800 && height <= 600)
>        bIsMin = true;
>    return bIsMin;
>}
>
>Tom
>"Ron H" <rnharsh@nospam.net> wrote in message 
>news:488f606e$0$13850$8d2e0cab@news.newsgroup-binaries.com...
>> How can I override the width & height values that my SDI app uses at run 
>> time? I tried modifying lpCREATESTRUCT but it ignores my changes ( or at 
>> least it seems to ). OR better yet how can I have it remember the last 
>> size when closed?
>>
>> -- 
>>
>> Ron H
>> -- 
>> This outgoing email was scanned by
>> Norton Antivirus Corp. Edition
>> and found to be virus free!
>>
>> -----------------
>> www.Newsgroup-Binaries.com - *Completion*Retention*Speed*
>> Access your favorite newsgroups from home or on the road
>> ----------------- 
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
7/30/2008 12:54:07 AM
Reply:

Similar Artilces:

outlook.pst file size
Hi Folks, I am having trouble deleting things from Outlook 2000. If I look at my Outlook.pst file, the size is 1,329,856 kb (pretty big!?). If I move some sent items to a folder on another drive - say I move 40 megs of files, check the Sent Items folder and confirm that they are gone, check Deleted Items and make sure that they are not there. Log out of Outlook and back in and look at my outlook.pst size, it does not change - still 1,329,856 kb! It continues to grow with every email that I send and receive. Am I doing something wrong? Thanks for your help. Ken Peoples Best regards, Ken...

Determining MFC version
How can I determine what version of MFC the app is being compiled under? I have some code that needs to be one way for legacy and another for VS2005. I have a simple #ifdef right now but I know there must be a way to do it without having to define this in the preprocessor directives. Thanks Eric > How can I determine what version of MFC the app is being compiled under? I > have some code that needs to be one way for legacy and another for VS2005. > I have a simple #ifdef right now but I know there must be a way to do it > without having to define this in the preprocess...

Discrepancy in size of pst files.
When I check the size of my pst files from within 0utlook, they are all around 700mb. However, when I check them in the actual folder where they are stored, then the main Personal pst file is over 2GB. I intentionally created 3 different pst files, so that I could keep their size down. But why is there this discrepancy in file sizes, and how can I split the 2GB one to make it smaller? There is always some overhead from meta-information in the pst-file and white space for performance reasons. This shouldn't be more than a 20% difference though. Most likely you've delete...

MFC and c++ problems
Forgive me if I'm overlooking the obvious. Basically, this is my problem: I have a derived Dialog: class A : public CDialog{ } I have a derived CTreeCtrl: class B : public CTreeCtrl{ } In A, there is an instance of B, as well as a bunch of other controls, which should contain information relating to the text for a tree item (HTREEITEM) in B. The information is stored in an INI file. Ok, I can get some of the windows messages to work in B, but begindrag() does not work at all (I've checked the create() settings, and it's not the TVS_DISABLEDRAGDROP flag). Basically, my ques...

Table size limits to 128 rows
I have a table in Word which is larger than 128 rows. 2003 Publisher can not convert or create a table larger than 128 rows. What are my options? Please don't tell me to break the large table into smaller tables... You don't want people to tell you to break the table but if you're limited to 128 rows and you have more than that - you may not have any other options. -- JoAnn Paules MVP Microsoft [Publisher] "Ed" <Ed@discussions.microsoft.com> wrote in message news:9A3F01C1-21D9-4FFC-B661-F303232BF9D6@microsoft.com... >I have a table in Word which i...

Use MFC from non-MFC application
Hello, Is it possible to use MFC functionality (and specifically windows and dialogs, like those that specialize CFrameWnd) from an application that is NOT written with MFC support. What I am thinking is that the main application is written so that it does display 'normal' windows (as opposed to being a console app) but doesn't have MFC support. The MFC functionality I would use (dialogs, windows) would be in a DLL linked into the non-MFC application. Is this possible? I apologize if this is a really dumb, obvious question. The one reference I found so far on the topic...

Move or Size Combo Box from forms toolbar With Cells
Hi : I would like to create a combo box from the forms toolbar and move or size it with cells so that if the rows or columns containing the box are hidden, the box will be hidden also. Is there a way to do this in excel? Thanks If you rightclick on the dropdown from the Forms toolbar, you can choose "format control". Then on the properties tab, you'll see that "move and size with cells" isn't available. Is there some overwhelming reason that you can't use the Combobox from the Control toolbox toolbar? It supports that option. steve-o wrote: > > H...

MFC menus with full-screen/windowed toggle
(previously posted in microsoft.public.win32.programmer.directx.graphics) I've an Windowed MFC app that I've written using VC++6 using GDI calls. I'm wanting to migrate this to DirectX (7, 8 or 9). The app only used blit's from preloaded bitmaps to the display and now I believe I have to recode this as copying to the back buffer during the begin/end of the Render function? I want to also allow the application to be mainly used in a full-screen mode as the window has a fixed size (640*480) and on a higher res desktop this isn't practical. Questions are: 1) Can I maintain...

MFC Program and ActiveX
I have written a MFC Program, how can i rewrite it into ActiveX Document so that I can open the program in the Internet Explorer (Like Java Applet)? Thanks, Marquis http://www.codersource.net/published/view/307/creating_custom_activex_controls_in_visual.aspx Tom "Marquis" <marquix@gmail.com> wrote in message news:1142525445.730104.171790@z34g2000cwc.googlegroups.com... >I have written a MFC Program, > how can i rewrite it into ActiveX Document > so that I can open the program in the Internet Explorer (Like Java > Applet)? > > Thanks, > Marquis > ...

Unmountable Boot Volume AND Session3 Initialization Failed
I'm running a Lenovo laptop with PGP Encryption Windows XP SP3 SATA hard drive. This is my work laptop I've had since October 2008 without issue. I'm somewhat of a low-level techie working permanently from home and my company's IT Dept is 2000 miles away. But these following errors/BSODs escapes me. Two days ago, the system stalled and I elected to hard reboot the system. When it came back up, I logged into PGP login screen as usual and received the 'Safe Mode' screen options. I clicked 'Start Windows Normally' option, the Windows Logo boot screen ...

How to setup MFC memory leak detection
Hi, All of my past projects have been begun as generic MFC applications, and I'm used to getting object dump messages when I close an app that has memory leaks. Right now, however, I'm working on an app that did not start out as an MFC app (it's actually a visual studio project generated by the Qt code generator, though I don't think that matters here); rather, it's a general C++ project. My question is: how do I setup whatever is needed so that I can get back those nice object dump messages. I've already altered the project settings to include MFC. What else do I need...

Copy/Paste, Tables and Font Size
Hello everybody! I have PowerPoint 2003 and the following problem: SITUATION: I have a slide which contains a table in which future users on different systems have to input information. They will c/p this information from other applications, most likely Word. PROBLEM: When they c/p the information into PowerPoint the font size of the copied text changes. MY WORKAROUND: I have set the text font size in the Master Slide text field to 13. This way the c/p'd data has the intended font size of 12. MY QUESTION: Is there a proper way to set default font sizes for...

I need help with MFC and Crystal Reports 9
I have created a VC++ 6 application using MFC. I have created my reports in Crystal Reports 9. Now I am having a problem on how to have my application call the crystal reports. I know that I need to create a class for printing and for previewing the cr reports. What .tlb do I need to use to create the problem COleDispatch derived classes? I have used CR with VB but using it with C++ seems to be a whole lot different. ...

Message Size Limit issue
One of our clients is running Exchange 2k3 SP1 in an 2k3 Active Directory domain. This morning, they called complaining that any email sent with an attachment that was over 2.5 Mbs in size was bouncing with a 5.2.3 NDR (Msg Size greater than allowed by Remote Host). Any message sent with a file attachment of less than 2.5 MBs is fine. The Exchange server connects to the internet through a linux firewall which I've tested sending files from as a user on the domain in order to remove it from the list of culprits. Tests from the firewall are normal. i've checked the configurat...

Set Time Frame to Print Calendar from OWA 07
How do I set the time frame that prints when trying to print calendars from Outlook Web Access 2007 I'm not aware of anyway to do that from OWA. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com/ Outlook Tips by email: mailto:dailytips-subscribe-request@lists.outlooktips.net EMO - a weekly newsletter about Outlook and Exchange: mailto:EMO-NEWSLETTER-SUBSCRIBE-REQUEST@PEACH.EASE.LSOFT.COM Do you sync your mailbox with a smartphone or pda? http://forums.slipstick.com/showthread...

OST File Size #2
We are in a hosted Exchange environment where each users is running Outlook 2003 in cached mode. However, we seem to be hitting the 2GB file limitation. I thought that Outlook 2003 does not have this limitation. I changed the user to online mode only - no caching. How do I proceed from here to create an OST file that can be bigger than 2 GB ? Steve -- If Outlook is Unicode it should be able to use up to a 20 gb OST file. However since an OST file is basically the same thing as a PST, this will likely impact performance. Check this Microsoft KB to see if it is of any use to you: http...

Viewing Attachment Sizes
Outlook 2003 The attachments are stored in the PST file. Is there a way to view a list of the attachments so I can determine their size. I could then delete attachments which take up too much space. Thank you for the feedback. That did the trick. I defined a new view definition called "My Attachment Size" using your suggestion. Is there a way to apply "My Attachment Size" View | Arrange By | Current View | My Attachment Size to every subfolder of the Inbox so when I select a subfolder "My Attachment Size" is the default view? It looks like one must manua...

A very simple question abt SDI title
Anyone who can tell me how to modify the SDI program's title -- "untitled" to something else? Thanks in advance. I think I remember entering this in the wizard that sets up the Project Workspace, but there's another way. Go to the Resource tab and open the String Table. Scroll down and modify the entry AFX_IDS_APP_TITLE. Rick Lee Bryan wrote: > Anyone who can tell me how to modify the SDI program's title -- "untitled" > to something else? > > Thanks in advance. "Bryan" <kfc@hotmail.com> wrote in message news:<OFRRLTmWEHA....

Email layout changes when sent (font size/bold etc)
Hi, We have a problem with emails which layout are changed after being sent. * Formatting changes (normal text gets bold, underlined) * Font types changes (also standard fonts like arial) * Font sizes change (is increased, mostly from 10 to 12) It happens with whole sentences/paragraphs. * The email in the 'Sent items' is ok * Email received is not ok. Server: Exchange Server 2003 Sp2, Exchange Server 5.5 SP4/Faxination (to be retired). Clients : Outlook 2000, 2002 and 2003 (mostly 2002, 2003). We had this problem already in 2004 when we were still on Exchange 5.5 with Outlook 2000...

<Re:how far do you think can Microsoft sustain this initiative?
Expert, Microsoft can easily tap crm market. Already Microsoft has presence in crm market. Hi, A recent report in Computer Weekly proclaimed that Microsoft was aiming to steam into untapped SME CRM market...how far do you think can Microsoft sustain this initiative? ________________________________________________________ http://www.techieindex.com ...

TDD for MFC
Newsgroupies: I research the interaction between Test-Driven Development and GUIs. When you write a GUI, you frequently skip testing in favor of just looking at the GUI to see results. The "Test First User Interfaces" concept advises you make GUIs easy to spot-check under test, and thence to leverage these checks to grow test fixtures that make spot-checks less important. The goal is rapid, heads-down coding of GUI effects without displaying the GUI. I wrote a recipe for submitting a legacy MFC program to the TFUI principles here: http://www.xpsd.org/cgi-bin/wiki?TfuiForMfc Ple...

How to round number in MFC?
I use MFC with VS 2008. I need to round certain value of number. Like this: 9.6 to 9.55 and other same kind number. How to do that? I have used ceil or floor but all of them are extreme ROUND UP / ROUND DOWN. Thank you. > I need to round certain value of number. Like this: 9.6 to 9.55 and other > same kind number. > > How to do that? I have used ceil or floor but all of them are extreme ROUND > UP / ROUND DOWN. Will This suit your needs? double round(const double& inValue) { double xShift = inValue - .5; double nShift = fix(xShift); if (xShift == nShift) { ...

How 2 set table size?
This is a multi-part message in MIME format. ------=_NextPart_000_0012_01C4D0A7.3F66BCF0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I was wondering if someone could point me in the right direction. I = need to create a table that is 5" x12" , contains 3 columns and 20 rows, = and I need to lock the cells so they do not expand. Here are my = questions: How do I specify the table size of 5" x 12"? How do lock the cell sizes? Thank you, Deb ------=_NextPart_000_0012_01C4D0A7.3F66BCF0 Content-Type: text/html; ...

How to reduce size of ms excel file-2003
I am usung excel 2003. A file containing 6000 records and 85 columns and used formula in each cell becomes a larger size and dificult in saivng. It takes more time. some time error occures "memory not enough". Is there any solution in excel 2003? If your formulas refer to more rows/columns than necessary, change it. If data no longer needs to be dynamic, Change formulas to values -- Don Guillett Microsoft MVP Excel SalesAid Software dguillett@gmail.com "vijay" <pv.cn1.gj@gmail.com> wrote in message news:622ee0ae-1d6f-48f4-86f6-58e0392ac64e@x23g2000prd...

Frame not becomming invisible
I have a form that contains several frames that are displayed or hidden under certain situations. One specific frame (fraProvider) is giving me problems. The frame is set to False in the properties. When I run the program normally the frame remains visible. If I step through the code the frame becomes invisible. The code is located in a sub and this is all that is in it. I assume it has to do with timing but I use this type of thing numerous time and this is the only time I have had a problem with it. Do I need to do something to slow down the execution and if so what? ...