Click here to Skip to main content
15,922,696 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCString Mid() Pin
RadioOpa20-Mar-06 20:30
RadioOpa20-Mar-06 20:30 
AnswerRe: CString Mid() Pin
Naveen20-Mar-06 20:42
Naveen20-Mar-06 20:42 
AnswerRe: CString Mid() Pin
bosfan20-Mar-06 20:50
bosfan20-Mar-06 20:50 
GeneralRe: CString Mid() Pin
RadioOpa20-Mar-06 21:14
RadioOpa20-Mar-06 21:14 
AnswerRe: CString Mid() Pin
Michael Dunn21-Mar-06 6:59
sitebuilderMichael Dunn21-Mar-06 6:59 
Questionchar array to CString ?? Pin
dharani20-Mar-06 20:16
dharani20-Mar-06 20:16 
AnswerRe: char array to CString ?? Pin
Cedric Moonen20-Mar-06 20:20
Cedric Moonen20-Mar-06 20:20 
GeneralRe: char array to CString ?? Pin
dharani20-Mar-06 21:37
dharani20-Mar-06 21:37 
GeneralRe: char array to CString ?? Pin
kakan20-Mar-06 23:12
professionalkakan20-Mar-06 23:12 
AnswerRe: char array to CString ?? Pin
James R. Twine21-Mar-06 6:59
James R. Twine21-Mar-06 6:59 
AnswerRe: char array to CString ?? Pin
Divyang Mithaiwala21-Mar-06 3:36
Divyang Mithaiwala21-Mar-06 3:36 
AnswerRe: char array to CString ?? Pin
toxcct21-Mar-06 4:10
toxcct21-Mar-06 4:10 
QuestionIs it possible to display Application's GUI/Console Window which activated by CreateProcess in Windows Service? Pin
yuguo.li20-Mar-06 19:51
yuguo.li20-Mar-06 19:51 
QuestionHelp,How to bind a web protocol? Pin
Jiang Miao20-Mar-06 19:48
Jiang Miao20-Mar-06 19:48 
AnswerRe: Help,How to bind a web protocol? Pin
Jiang Miao20-Mar-06 20:18
Jiang Miao20-Mar-06 20:18 
Questioncreating a bitmap // filling colors in "BITMAP" Pin
himuskanhere20-Mar-06 19:07
himuskanhere20-Mar-06 19:07 
AnswerRe: creating a bitmap // filling colors in "BITMAP" Pin
Hamid_RT20-Mar-06 19:54
Hamid_RT20-Mar-06 19:54 
Questionfilling colors in "BITMAP" Pin
himuskanhere20-Mar-06 19:05
himuskanhere20-Mar-06 19:05 
Question__RPC_FAR Pin
HakunaMatada20-Mar-06 18:46
HakunaMatada20-Mar-06 18:46 
AnswerRe: __RPC_FAR Pin
Nibu babu thomas20-Mar-06 19:22
Nibu babu thomas20-Mar-06 19:22 
QuestionChanging the dialog font Pin
Naveen20-Mar-06 18:35
Naveen20-Mar-06 18:35 
AnswerRe: Changing the dialog font Pin
ashokbngr20-Mar-06 18:59
ashokbngr20-Mar-06 18:59 
AnswerRe: Changing the dialog font Pin
ashokbngr20-Mar-06 19:01
ashokbngr20-Mar-06 19:01 
1. place the following string somewhere in your "stdafx.h" file:

#include <afxpriv.h>
2. override DoModal() function in your dialog class:

int CSampleDialog::DoModal()
{
CDialogTemplate dlt;
int nResult;

// load dialog template
if (!dlt.Load(MAKEINTRESOURCE(CSampleDialog::IDD))) return -1;

// set your own font, for example "Arial", 10 pts.
dlt.SetFont("Arial", 10);

// get pointer to the modified dialog template
LPSTR pdata = (LPSTR)GlobalLock(dlt.m_hTemplate);

// let MFC know that you are using your own template
m_lpszTemplateName = NULL;
InitModalIndirect(pdata);

// display dialog box
nResult = CDialog::DoModal();

// unlock memory object
GlobalUnlock(dlt.m_hTemplate);

return nResult;
}

It may be reasonable to choose a font for your dialog box according to user-specified schemes (those in Control Panel / Display / Appearance). Unfortunately I was unable to find any simple ways to get font settings for the dialog boxes. A possible alternative is to use font settings for icon titles and some related controls (like tree and list controls), that can be retrieved by SystemParametersInfo() function. Here is a simple procedure that returns the face name and the size in points for this font:


void GetSystemIconFont(CString& strFontName,int& nPointSize)
{
LOGFONT lf;

// get LOGFONT structure for the icon font
SystemParametersInfo(SPI_GETICONTITLELOGFONT,sizeof(LOGFONT),&lf,0);

// getting number of pixels per logical inch
// along the display height
COLOR="#990000">
HDC hDC = ::GetDC(NULL);
int nLPixY = GetDeviceCaps(hDC, LOGPIXELSY);
::ReleaseDC(NULL,hDC);

// copy font parameters
nPointSize = -MulDiv(lf.lfHeight,72,nLPixY);
strFontName = lf.lfFaceName;
}





Ashok Reddy
GeneralRe: Changing the dialog font Pin
Naveen20-Mar-06 19:35
Naveen20-Mar-06 19:35 
GeneralRe: Changing the dialog font Pin
ashokbngr20-Mar-06 21:39
ashokbngr20-Mar-06 21:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.