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. Q: how to obtain message box font display property setting

Q: how to obtain message box font display property setting

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
7 Posts 3 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.
  • G Offline
    G Offline
    Gil Clark
    wrote on last edited by
    #1

    Hey everybody. You know how in Windows Display Properties Appearance you can change the colors and fonts for many system items like menus, 3DObjects, etc. You can obtain the color settings using GetSysColor(), but I was just wondering if anybody out there knew how to obtain the font settings for the items? Particularly the Message Box. I've searched through Code Project and MS Knowledge Base but didn't find anything (probably not using the right keywords or something). Anyone? Thanks

    R M 2 Replies Last reply
    0
    • G Gil Clark

      Hey everybody. You know how in Windows Display Properties Appearance you can change the colors and fonts for many system items like menus, 3DObjects, etc. You can obtain the color settings using GetSysColor(), but I was just wondering if anybody out there knew how to obtain the font settings for the items? Particularly the Message Box. I've searched through Code Project and MS Knowledge Base but didn't find anything (probably not using the right keywords or something). Anyone? Thanks

      R Offline
      R Offline
      Roger Allen
      wrote on last edited by
      #2

      In MFC you shoul dbe able to get a handle to some fonts by using the AUX_DATA structure afxData. It has some fonts in it as HFONT objects. Nit sure if they are the ones you need. Roger Allen Sonork 100.10016 If I had a quote, it would be a very good one.

      G 1 Reply Last reply
      0
      • G Gil Clark

        Hey everybody. You know how in Windows Display Properties Appearance you can change the colors and fonts for many system items like menus, 3DObjects, etc. You can obtain the color settings using GetSysColor(), but I was just wondering if anybody out there knew how to obtain the font settings for the items? Particularly the Message Box. I've searched through Code Project and MS Knowledge Base but didn't find anything (probably not using the right keywords or something). Anyone? Thanks

        M Offline
        M Offline
        Maxwell Chen
        wrote on last edited by
        #3

        Try

        SystemParametersInfo( )

        Maxwell Chen No code is good code.

        G 1 Reply Last reply
        0
        • M Maxwell Chen

          Try

          SystemParametersInfo( )

          Maxwell Chen No code is good code.

          G Offline
          G Offline
          Gil Clark
          wrote on last edited by
          #4

          I've looked at that already, but didn't find anything. Which action value?

          M 1 Reply Last reply
          0
          • G Gil Clark

            I've looked at that already, but didn't find anything. Which action value?

            M Offline
            M Offline
            Maxwell Chen
            wrote on last edited by
            #5

            Try this, I tried, and changed some values, and my Windows2K got strange...

            void CTestMsgFontDlg::OnButton1()
            {
            NONCLIENTMETRICS ncmOld, ncmTest;

            AfxMessageBox(\_T("Test change of font for message boxes."), MB\_OK);
            ncmOld.cbSize = sizeof(NONCLIENTMETRICS);
            if(SystemParametersInfo(SPI\_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncmOld, 0))
            {
            	memcpy(&ncmTest, &ncmOld, sizeof(NONCLIENTMETRICS));
            	ncmTest.lfMessageFont.lfUnderline = 1;
            	
            	AfxMessageBox(\_T("Before change of font for message boxes."), MB\_OK);
            	if(SystemParametersInfo(SPI\_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncmTest, 0))
            	{
            		AfxMessageBox(\_T("Message box font changed."), MB\_OK);
            		ncmOld.lfMessageFont.lfUnderline = 0;
            		SystemParametersInfo(SPI\_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncmOld, 0);
            		AfxMessageBox(\_T("Message box font restored."), MB\_OK);
            	}
            }
            

            }

            Maxwell Chen No code is good code.

            G 1 Reply Last reply
            0
            • R Roger Allen

              In MFC you shoul dbe able to get a handle to some fonts by using the AUX_DATA structure afxData. It has some fonts in it as HFONT objects. Nit sure if they are the ones you need. Roger Allen Sonork 100.10016 If I had a quote, it would be a very good one.

              G Offline
              G Offline
              Gil Clark
              wrote on last edited by
              #6

              I'd prefer a non-mfc approach (sdk). The only 2 fonts I find in that AUX_DATA structure are StatusFont and ToolTipsFont (at least in the version I have).

              1 Reply Last reply
              0
              • M Maxwell Chen

                Try this, I tried, and changed some values, and my Windows2K got strange...

                void CTestMsgFontDlg::OnButton1()
                {
                NONCLIENTMETRICS ncmOld, ncmTest;

                AfxMessageBox(\_T("Test change of font for message boxes."), MB\_OK);
                ncmOld.cbSize = sizeof(NONCLIENTMETRICS);
                if(SystemParametersInfo(SPI\_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncmOld, 0))
                {
                	memcpy(&ncmTest, &ncmOld, sizeof(NONCLIENTMETRICS));
                	ncmTest.lfMessageFont.lfUnderline = 1;
                	
                	AfxMessageBox(\_T("Before change of font for message boxes."), MB\_OK);
                	if(SystemParametersInfo(SPI\_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncmTest, 0))
                	{
                		AfxMessageBox(\_T("Message box font changed."), MB\_OK);
                		ncmOld.lfMessageFont.lfUnderline = 0;
                		SystemParametersInfo(SPI\_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncmOld, 0);
                		AfxMessageBox(\_T("Message box font restored."), MB\_OK);
                	}
                }
                

                }

                Maxwell Chen No code is good code.

                G Offline
                G Offline
                Gil Clark
                wrote on last edited by
                #7

                Too cool. Thanks. The name of that item is mis-leading. NONCLIENT. I thought it would be the font used for the maximize, minimize, close buttons.

                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