Q: how to obtain message box font display property setting
-
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
-
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
In MFC you shoul dbe able to get a handle to some fonts by using the
AUX_DATA
structureafxData
. It has some fonts in it asHFONT
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. -
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
Try
SystemParametersInfo( )
Maxwell Chen No code is good code.
-
Try
SystemParametersInfo( )
Maxwell Chen No code is good code.
-
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.
-
In MFC you shoul dbe able to get a handle to some fonts by using the
AUX_DATA
structureafxData
. It has some fonts in it asHFONT
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. -
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.