Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. reduce size of CFileDialog

reduce size of CFileDialog

Scheduled Pinned Locked Moved C / C++ / MFC
11 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    FarPointer
    wrote on last edited by
    #1

    Hi, i want to reduce the size of the CFileDialog(or any Common Dialog) i mean i need to compress(Shrink it ) it so it looks small. Regards FarPointer

    Mircea PuiuM R 2 Replies Last reply
    0
    • F FarPointer

      Hi, i want to reduce the size of the CFileDialog(or any Common Dialog) i mean i need to compress(Shrink it ) it so it looks small. Regards FarPointer

      Mircea PuiuM Offline
      Mircea PuiuM Offline
      Mircea Puiu
      wrote on last edited by
      #2

      MoveWindow() for example .... SkyWalker

      1 Reply Last reply
      0
      • F FarPointer

        Hi, i want to reduce the size of the CFileDialog(or any Common Dialog) i mean i need to compress(Shrink it ) it so it looks small. Regards FarPointer

        R Offline
        R Offline
        RaajaOfSelf
        wrote on last edited by
        #3

        MoveWindow may not work ,if you are using DoModal ()directly on a object of CFileDialog Inherit a class from CFileDialog and over -ride the OnInitdialog .Now include the MoveWindow() Cause is my effort; Effect is God's effort

        B 1 Reply Last reply
        0
        • R RaajaOfSelf

          MoveWindow may not work ,if you are using DoModal ()directly on a object of CFileDialog Inherit a class from CFileDialog and over -ride the OnInitdialog .Now include the MoveWindow() Cause is my effort; Effect is God's effort

          B Offline
          B Offline
          bugDanny
          wrote on last edited by
          #4

          If you didn't want to inherit the class and override OnInitDialog, you could probably just declare the dialog, say CFileDialog myDialog and then call myDialog.CalcWindowRect() and pass the resulting RECT or CRect structure into myDialog.Create(). This is how the framework already sets up the window size prior to creation, but if you do some of it yourself, you can change the RECT or CRect structure in between to whatever size you wish. I've never actually tried this myself in practice, but reading through the documentation, it should work. Check out MSDN. Danny The stupidity of others amazes me!

          R 1 Reply Last reply
          0
          • B bugDanny

            If you didn't want to inherit the class and override OnInitDialog, you could probably just declare the dialog, say CFileDialog myDialog and then call myDialog.CalcWindowRect() and pass the resulting RECT or CRect structure into myDialog.Create(). This is how the framework already sets up the window size prior to creation, but if you do some of it yourself, you can change the RECT or CRect structure in between to whatever size you wish. I've never actually tried this myself in practice, but reading through the documentation, it should work. Check out MSDN. Danny The stupidity of others amazes me!

            R Offline
            R Offline
            RaajaOfSelf
            wrote on last edited by
            #5

            I guess this method won't work as the HWND of the CFileDialogis not yet created ! (Worst case - try with Hooks ) . Install a hook before Do Modal () Handle the Hook for it and delete the hook after that . Cause is my effort; Effect is God's effort

            B 1 Reply Last reply
            0
            • R RaajaOfSelf

              I guess this method won't work as the HWND of the CFileDialogis not yet created ! (Worst case - try with Hooks ) . Install a hook before Do Modal () Handle the Hook for it and delete the hook after that . Cause is my effort; Effect is God's effort

              B Offline
              B Offline
              bugDanny
              wrote on last edited by
              #6

              The method I noted in my post only handles a CRect or RECT structure, so you don't need the window to be created yet, but yes, your method, Raaja, would require the window to be created already. Danny The stupidity of others amazes me!

              R 1 Reply Last reply
              0
              • B bugDanny

                The method I noted in my post only handles a CRect or RECT structure, so you don't need the window to be created yet, but yes, your method, Raaja, would require the window to be created already. Danny The stupidity of others amazes me!

                R Offline
                R Offline
                RaajaOfSelf
                wrote on last edited by
                #7

                CFileDialog myDialog myDialog.CalcWindowRect() myDIalog.create .... If this is what you have suggested ,then CalcWindowRect () call is going to fail as the window is not yet created ! Check for the Assert statement in CWnd ::GetExStyle() which is accessed in CalcWindowRect() Cause is my effort; Effect is God's effort

                B 1 Reply Last reply
                0
                • R RaajaOfSelf

                  CFileDialog myDialog myDialog.CalcWindowRect() myDIalog.create .... If this is what you have suggested ,then CalcWindowRect () call is going to fail as the window is not yet created ! Check for the Assert statement in CWnd ::GetExStyle() which is accessed in CalcWindowRect() Cause is my effort; Effect is God's effort

                  B Offline
                  B Offline
                  bugDanny
                  wrote on last edited by
                  #8

                  Ah, I see that MFC guru. Since you know MFC so well, explain this explanation of CalcWindowRect, "Call this member function to compute the required size of the window rectangle based on the desired client-rectangle size. The resulting window rectangle (contained in lpClientRect) can then be passed to the Create member function to create a window whose client area is the desired size. Called by the framework to size windows prior to creation. A client rectangle is the smallest rectangle that completely encloses a client area. A window rectangle is the smallest rectangle that completely encloses the window." I noted in there some phrases like, this is "called by the framework to size windows prior to creation" and how this function is called "to compute the required size of the window" and then you can pass the rectangle "to the Create Member function to create a window". Do you have some constructive critism, like how he might be able to make this work? Danny The stupidity of others amazes me!

                  F R 2 Replies Last reply
                  0
                  • B bugDanny

                    Ah, I see that MFC guru. Since you know MFC so well, explain this explanation of CalcWindowRect, "Call this member function to compute the required size of the window rectangle based on the desired client-rectangle size. The resulting window rectangle (contained in lpClientRect) can then be passed to the Create member function to create a window whose client area is the desired size. Called by the framework to size windows prior to creation. A client rectangle is the smallest rectangle that completely encloses a client area. A window rectangle is the smallest rectangle that completely encloses the window." I noted in there some phrases like, this is "called by the framework to size windows prior to creation" and how this function is called "to compute the required size of the window" and then you can pass the rectangle "to the Create Member function to create a window". Do you have some constructive critism, like how he might be able to make this work? Danny The stupidity of others amazes me!

                    F Offline
                    F Offline
                    FarPointer
                    wrote on last edited by
                    #9

                    hi can i overide my GetWindowRect.

                    B 1 Reply Last reply
                    0
                    • B bugDanny

                      Ah, I see that MFC guru. Since you know MFC so well, explain this explanation of CalcWindowRect, "Call this member function to compute the required size of the window rectangle based on the desired client-rectangle size. The resulting window rectangle (contained in lpClientRect) can then be passed to the Create member function to create a window whose client area is the desired size. Called by the framework to size windows prior to creation. A client rectangle is the smallest rectangle that completely encloses a client area. A window rectangle is the smallest rectangle that completely encloses the window." I noted in there some phrases like, this is "called by the framework to size windows prior to creation" and how this function is called "to compute the required size of the window" and then you can pass the rectangle "to the Create Member function to create a window". Do you have some constructive critism, like how he might be able to make this work? Danny The stupidity of others amazes me!

                      R Offline
                      R Offline
                      RaajaOfSelf
                      wrote on last edited by
                      #10

                      DOn't take this personally danny !!!Iam no expert ,iam just sharing what i have tried in Visual Studio ..thats it . I just refrred to the example in MSDN http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/\_mfc\_cwnd.3a3a.calcwindowrect.asp If thee link is not working ,refer to Cwnd ::calWindowRect in MSDN and refer to the example given at the end . calcWindowRect will calculate the window Rectangle ,given the client reactangle size (required size). In this case ,ur call to calcWindowrect will return the same client rectangle size as m_hWnd of that window is NULL .CHeck CWnd::GetStyle() and CWnd ::calWindowrect() . In this case CalcWindowRect won't be useful at all .U can directly use Create with required window size . Cause is my effort; Effect is God's effort

                      1 Reply Last reply
                      0
                      • F FarPointer

                        hi can i overide my GetWindowRect.

                        B Offline
                        B Offline
                        bugDanny
                        wrote on last edited by
                        #11

                        Not sure, but I would guess, no. Danny The stupidity of others amazes me!

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups