How to add Maximize box on a dialog created by using CDialog

I want to have a maximize box on the Dialoog which is created by inheriting
CDialog class on a specific case.
Controls on that dialog should also get resized accordingly.
For example the size of the list control on that dialog should be state
specific(max or min).

12/19/2005 8:43:38 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 23

In the PreCreateWindow for your subclass, add in the style (It think it is WS_MAXIMIZEBOX)
to force the maximize box to appear.

In your OnSize handler, you do whatever it takes to resize the controls.  For example,
here's a case where the listbox occupies the bottom of the dialog:

void CMyDialog::OnSize(int cx, int cy)
    CDialog::OnSize(cx, cy);
    if(c_DataDisplay.GetSafeHwnd() != NULL)
       { /* has listbox */.
        CRect r;
        c_DataDisplay.SetWindowPos(NULL,  // no Z-order
                                                                  0,0, // no change in pos
                                                                  cx,  // new width
                                                                  cy -, // new ht
                                         SWP_NOMOVE | SWP_NOZORDER);
     } /* has listbox */
   if(c_Filename.GetSafeHwnd() != NULL)
     { /* has filename control */
       CRect r;
                                               cx - r.left, cy -,
                                          SWP_NOMOVE | SWP_NOZORDER);
      } /* has filename control */

Note if the filename had a "browse" button to its right, you might also add

     if(c_Browse.GetSafeHwnd() != NULL && c_Filename.GetSafeHwnd() != NULL)
       { /* move browse button */
        CRect name;

        CRect browse;

                                 name.left + gap,,
                                 0, 0, 
                                 SWP_NOSIZE | SWP_NOZORDER);
      // gap was computed, for example, in OnInitDialog, based on
      // the initial layout, e.g.  in OnInitDialog do
      //   CRect name;
      //   .. get name rect, as above
     //   CRect browse;
     //    ... get browse rect as above
     //   gap = browse.left - name.right;;
  } /* move browse button */


(Note that this assumes those silly guides are removed and the listbox is already as wide
as, and extends to the bottom, of the dialog.  Otherwise, the geometry calculations get a
bit more complex, but are doable).

For resizing other controls, or doing rearrangements, you are on your own to do the
geometry.  However, note that on either or there are
some libraries called "layout" or "geometry" libraries that will simplify this if you have
a lot of rearrangement/resizing to do.
On Mon, 19 Dec 2005 14:13:38 +0530, "Ankit Tyagi" <> wrote:

>I want to have a maximize box on the Dialoog which is created by inheriting
>CDialog class on a specific case.
>Controls on that dialog should also get resized accordingly.
>For example the size of the list control on that dialog should be state
>specific(max or min).
Joseph M. Newcomer [MVP]
MVP Tips:
newcomer (15974)
12/19/2005 3:10:38 PM

Similar Artilces:

Outlook exiting box hangs forever
Hello, Running Outlook 2000 on exchange 2000. If the outlook is open for couple days and when i close it, exiting box hangs forever. But, if I open and close outlook right away or within couple hours, it exits fine. Any ideas? kirit Do you have it set to synch offline folders? If yes, and you have received a lot of mail and only have it set to sync on shutdown, it will, of course, take more time after a couple of days worth of items need to be synched. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the SWEN virus, all mail sent to...

How do I add a Web Access Account to my Outlook at home?
That sounds strange, but I'm a student at a university that has given me an Outlook Account on Web Access for the purpose of receiving school mail, mainly school-wide announcements and information from professors. However, I find the online version to be very limiting and I'm not familiar with the newer versions of Outlook (haven't had it since about 1996 or so). I need to know if I can access e-mails recieved on my Web Access account in my Outlook program at home... Also, maybe if this is possible I won't have to do that... Can I organized e-mails on Web Access? I k...

Using VBS t o configure outlook
is it possible to create a vbs script to automatically configure outlook 2002 for user on a domain. Thanks James ...

Using Exmerge #2
Hi there, I'm using Exmerge for the first time on an Exchange 2003 box. I was reading through the KB article 174197 and it says "Before you run this program, make sure that the Microsoft Outlook Client and the Microsoft Exchange Administrator program are installed on the computer that Exmerge.exe is being run on." then in the next paragraph it notes, "We recommend that you do not install Outlook on the Exchange server." So, before I go installing anything can someone please point me in the correct direction? Can I run exmerg...

Virus Outbreak by using SMTP virtual server
Hi, The client was accidentally open file then the nightmare began to spread out. It will use "system administrator" and "webmaster" as sender to inform the user that their password is grant or deny. Today, it tried to send out as NDR style. I assumed the virus on the workstation is using our smtp server. Will there a log that SMTP virtual server may generate so I can keep cross reference such as workstation or username so I can pinpoint? Any suggestion or recommendation will be appreciated. I am currently using Trend Micro Offican or Scan...

Cannot Create Quick Campaign 07-27-06
When I've selected some contacts and clicked on "Create Quick Campaign", the page that pops up (http://crm/MA/MiniCampaign/iframes/emailForm.aspx) shows 2 script errors: An error has ocurred in the script on this page: 'null' is null or not an object And after that: An error has ocurred in the script on this page: Object doesn't support this property or method If I click 'Yes' or 'No' on the "do you still want to use scripts on this page"-poup, I countinue to create the campaign, but no emails are created. If I open the Quick Campaign ...

no warning file in use
Hi. I've got a question about a shared Excel file stored on Windows 2000 server. This file is accessed by two different Windows XP end users running Excel 2002 on their machines. Recently these two different end users have been accessing the same shared Excel file simultaneously without the usual file lock or warning that the file is in use. Sometimes they get the warning, sometimes not. When they don't, they assume they have rights to save to the file, only to find later on that their changes were not saved. I'm having both check for updates so that their Microsoft s...

Change Value on Combo Box upon event
Is there a way that I can change the value on a Combo Box to the last record in its record source? I have a combo box that displays Fiscal Years, from 2000 to Current fiscal year 2007. Users can select any year they wish to pull data from based on the year selected. However, I want the combo Box to change its value to the current Fiscal year (which is the last record presented to them when they select the drop down) based on a specific event. Anybody have any ideas? Thanks! heyy try: Me.CourseID = Me.CourseID.ItemData(Me.CourseID.ListCount - 1) cheers jeff "Angel_G" ...

sql to create totals
I have a query that counts the number of records where the criteria has defined values. This produces a list of the number of records for each month based on a field txtmonth . Here is the sql and the results. SELECT tblhvdealspt1.txtpurpose, Count(tblhvdealspt1.ID) AS CountOfID, tblhvdealspt1.txtmonth FROM tblhvdealspt1 WHERE (((tblhvdealspt1.txtpurpose)="Buyout" Or (tblhvdealspt1.txtpurpose) ="Refinancing" Or (tblhvdealspt1.txtpurpose)="Corporate Finance" Or (tblhvdealspt1.txtpurpose)="Restructuring")) GROUP BY tblhvdealspt1.txtpurpose, tbl...

How to Add Custom Attribute to N to N Relational Entity
Hi, we have inquiry entity that is relation to account and contact with n to n relation. ,Crm create a new relational table like inquiry_account and inquiry_contact automatically so How to Add Custom Attribute to inquiry_account and inquiry_contact Also, I need to update this custom attribute record when contact or account accept to inquiry On Jun 26, 12:43=A0am, MehmetCelik <> wrote: > Hi, > we have inquiry entity that is relation to account and contact with n > to n relation. > ,Crm create a new relational table like inquiry_account and > inquiry_cont...

Problem with "Search box" in Help window
We are using Excel 2003 on XP. This problem is occuring for all users. When you click Help-Microsoft Excel Help, and try to type in the Search for: box under Assistance, the text is inserted into the spreadsheet instead. The only way you can manage to enter any text into this box is to copy it, then right-click paste it into that box (Edit-Paste and Ctrl+V do not work) I can't find anything in the kbase (except for the tip about pasting). What is up with this? ...

Capture F1 key in Customize toolbar dialog
Hi, I am using VS 2002/MFC to develop an application and I need to capture the F1 key in the customize toolbar dialog box. I am bringing up the customize toolbar dialog box by calling the CToolBarCtrl::Customize. I get TBN_CUSTHELP on click of the Help button on the dialog box, but not when I press F1 key. Any help in resolving this is appreciated. I have hooking as the last option. I also wonder why this is not a straight forward thing to happen. Thanks in advance, GSD ...

SUMPRODUCT using Time between two values
Thanks in advance for any help you can provide me. I have a sheet with the following layout of data (shortened here and changed for obvious reasons) Venue Date Event Start Event End Act Disney 4/13/10 7:00 PM 10:00 PM Goofy MSG 2/13/10 1:00 PM 3:00 PM Basketball Park 3/14/10 6:00 PM 8:00 PM Harlem Globetrotters So, what I have is a user input a Venue, Date, Time Value, and I would need the Act returned... For example, Disney, 4/13/10, 8:25:13 PM, would ou...

Open form in dialog mode
Hi, I have an invoice form that has a button on it for adding a new sales item if the one the user needs isn't there. The button should open the sales item form in dialog mode so that when I close the pop up form I can have some refresh code run on the invoice so that the combo box updates to include that new item. The problem is that when I open the new form in dialog mode the window opens to full screen, across the Windows taskbar at the bottom of the screen. Also, my navigation buttons in the form footer get hidden sometimes. Can anyone tell me what to do to avoid this problem? ...

Excel Queries using Access data
Im trying to create a query from within Excel. When I select new database query and select a database which has no securtiy login/password, no problem, works fine. However, when I try to source the data from a database which I have created using user logins/passwords it says that I do not have admin privilages to use the database even though I am putting in the correct login/username in the popup window? Please can anyone help? I've had limited experience with this sort of thing but I've always had to strip out the protection on the Access Database and create a copy before suc...

Converting access tables to XML for use in .NET web app
I need to access tables in an .mdb file and convert them to XML for use in my ..NET 2.0 web application. Can anyone point me to any tutorials or references on how to accomplish this? (Note: I am using VB) Thanks! ...

Possible to open word documents in Excel using hyperlinks?
Hi, I wondered whether it was possible to open office documents from within MS Excel using hyperlinks to the related files. The documents in question are MS Word format. Cheers Have you try it ? Ctrl-K Existing file ...... -- Regards Ron de Bruin "DobieM" <> wrote in message > Hi, > I wondered whether it was possible to open office documents from within MS > Excel using hyperlinks to the related files. The documents in question are MS > Wor...

Can't seem to enforce a newly created Recepient Policy...
Hi Everyone: I just created a new recepient policy. I would like this policy to set my newly created users in a specific OU to assign them a different email domain which in our case is when my users in that OU are created. I have created the new OU, and a universal security group in that OU as well as users. I make sure i put my users in that security group. My policy has the following filter rule: (&(&(&(objectCategory=*)(memberOf=CN=security_group_name,OU=OU_with_new_doma in_users,OU=OU_with_all_domain_users,DC=domain,DC=com)))) Now, when i add my users to...

How do I add color to an image?
I have been sent an image that I have scanned into MicroSoft Publisher. The image is black and white. I would like to change it to a color image. Is this possible? If you want to edit the photo and it's colors, you will need an image editing program, such as Microsoft PhotoDraw 2000 v2, Microsoft Paint, Adobe Photoshop, Paintshop, etc. I recommend you scan the image into one of those programs instead of scanning into Publisher. -- Brian Kvalheim Microsoft Publisher MVP This posting is provided "AS IS" with no warranties, and confers no rig...

Remove blank entries from a list box either using VBA or basic formula #3
Thanks Debra Havent thought about using dynamic ranges before.....I am a bit of Excel learner. I shall look into this as you suggest. Thanks again Celtic_avenge -- Celtic_Avenge ----------------------------------------------------------------------- Celtic_Avenger's Profile: View this thread: ...

Can you share a calendar using Outlook web access?
We are using Outlook Web Access only. Is there a way to share calendars? In, betzie <> typed: > We are using Outlook Web Access only. Is there a way to share > calendars? You can access a calendar (or any mailbox folder, I believe) if it's already shared - but you can't create the share/set the permissions in OWA. You might post OWA questions in - OWA is part of Exchange, not Outlook. ...

Use Excel to make an update query to another database table?
I have a spreadsheet in Excel with information on it that I'd like to update to a database table (outside of Excel). I have been using Excel to pull database information in, and now I'd like to use it to write data to the same table. To this point I've just been copying the data into an Access table and creating an update query. Anyway to get Excel to do this?? Many thanks in advance. ...

Using mail-to hyperlink with an attachment
I'm creating forms using Excel and Word. Somewhere in the form is an email address. I can use Edit-hyperlink to specify the recipient address of the email address as well as the subject field. Great. What I'd really like is to be able to specify that the form file itself (the ..doc or .xls) is also attached to the email message. I'd like to specify that right in the hyperlink. Then it can act as a workflow. I don't know anything about VBA so I'd rather not go there. Is this possible? ...

Sync between Sent Items-mailbox when using OWA and Sent Items in P
Dear Sir In my office I use outlook connected to exchange server through a LAN, where I send and receive emails normally. I use Personal Folders so I find all received emails in Inbox and all sent emails in Sent Items of the personal folder. At weekend I close my outlook before I go home in order to keep all my received emails in the mail box of the server, I use Outlook Web Access (OWA) connected to the exchange server through the internet where I send and receive email normally and I find all the received emails in the Inbox and all the sent emails in the Sent Items of the...

Add Class from Typelib Wizard
My project uses a custom COM component that another vendor created for us. I can successfully "add class from typelib" with VS2003. When I try to do the same thing in VS2005, I can see and select the typelib, but no interfaces will show up in the "Interfaces" box. This prevents me from wrapping the COM object and using it from my VS2005 MFC project. Does anyone know what might be happening here? The COM component is correctly installed on the computer and works well. Ed D wrote: > My project uses a cust...