Click here to Skip to main content
15,907,396 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDetecting Keyboard Input in Console Application Pin
Tomaz Rotovnik27-Feb-04 1:11
Tomaz Rotovnik27-Feb-04 1:11 
GeneralRe: Detecting Keyboard Input in Console Application Pin
Selvam R27-Feb-04 1:19
professionalSelvam R27-Feb-04 1:19 
GeneralRe: Detecting Keyboard Input in Console Application Pin
catngo27-Feb-04 19:24
catngo27-Feb-04 19:24 
GeneralSorting an array with pointers Pin
hollowsoft27-Feb-04 0:52
hollowsoft27-Feb-04 0:52 
GeneralRe: Sorting an array with pointers Pin
Selvam R27-Feb-04 1:16
professionalSelvam R27-Feb-04 1:16 
GeneralRe: Sorting an array with pointers Pin
Kevin McFarlane27-Feb-04 1:17
Kevin McFarlane27-Feb-04 1:17 
GeneralRe: Sorting an array with pointers Pin
Kevin McFarlane27-Feb-04 4:46
Kevin McFarlane27-Feb-04 4:46 
GeneralRe: Sorting an array with pointers Pin
David Crow27-Feb-04 5:28
David Crow27-Feb-04 5:28 
GeneralGlyph Repositioning Pin
Member 88417927-Feb-04 0:24
Member 88417927-Feb-04 0:24 
QuestionVideo memory, why so slow? Pin
includeh1027-Feb-04 0:01
includeh1027-Feb-04 0:01 
QuestionMessageBox and font changing? Pin
Jump_Around26-Feb-04 23:57
Jump_Around26-Feb-04 23:57 
AnswerRe: MessageBox and font changing? Pin
Prakash Nadar27-Feb-04 0:11
Prakash Nadar27-Feb-04 0:11 
GeneralProblem with critical section. Pin
Prakash Nadar26-Feb-04 23:47
Prakash Nadar26-Feb-04 23:47 
GeneralRe: Problem with critical section. Pin
_Magnus_27-Feb-04 0:11
_Magnus_27-Feb-04 0:11 
GeneralRe: Problem with critical section. Pin
Prakash Nadar27-Feb-04 0:14
Prakash Nadar27-Feb-04 0:14 
GeneralEdit control and Unicode Pin
Jahangir Jamshed26-Feb-04 23:47
sussJahangir Jamshed26-Feb-04 23:47 
GeneralRe: Edit control and Unicode Pin
Prakash Nadar27-Feb-04 0:08
Prakash Nadar27-Feb-04 0:08 
GeneralCRichEdit, default font settings Pin
Shah Shehpori26-Feb-04 23:37
sussShah Shehpori26-Feb-04 23:37 
Friends,

I've a simple dialog based application. I dropped a Rich Edit control on a dialog. I run the program and it runs fine. As such the font typed in the rich edit box is the one provided by Windows as default font.

Now i want to display the text in rich edit box with my custom fonts settings. I got a routine to do so. And i want my font settings to be applied as default when the application runs. So i am calling my function of font change in OnInitDialog().

OnInitDialog()
{
 m_myRichEdit.SetFont("Tahoma");
 m_myrichEdit.SetFontSize(22);
}


But when i run my application, these settings are not getting applied Frown | :( Instead if i remove the code from OnInitDialog() and place it in OnOk() handler then it gets applied if the user presses the OK button.

But i want my settings to be applied immediately when the application runs i.e applied as default.

How can i do so ???

The routines are:

void CRichEditCtrlEx::SetFontName(CString sFontName)
{
   CHARFORMAT cf = GetCharFormat();

	// Set the font name.
   ZeroMemory(cf.szFaceName, 32);

	for (int i = 0; i <= sFontName.GetLength()-1; i++)
		cf.szFaceName[i] = sFontName[i];

	ZeroMemory(cf.szFaceName+ sFontName.GetLength(), 2);

	cf.dwMask = CFM_FACE;

	SetSelectionCharFormat(cf);
   
}

void CRichEditCtrlEx::SetFontSize(int nPointSize)
{
	CHARFORMAT cf = GetCharFormat();

	nPointSize *= 20;	// convert from to twips
	cf.yHeight = nPointSize;
	
	cf.dwMask = CFM_SIZE;

	//SetSelectionCharFormat(cf);
	SetDefaultCharFormat(cf);
}

Questionhow can i make some pictures into Panoramic image Pin
xnew26-Feb-04 23:21
xnew26-Feb-04 23:21 
AnswerRe: how can i make some pictures into Panoramic image Pin
telstar27-Feb-04 8:00
telstar27-Feb-04 8:00 
GeneralProb on Tasktray icons. Pin
Prakash Nadar26-Feb-04 23:13
Prakash Nadar26-Feb-04 23:13 
GeneralRe: Prob on Tasktray icons. Pin
Shog927-Feb-04 5:35
sitebuilderShog927-Feb-04 5:35 
GeneralRe: Prob on Tasktray icons. Pin
Prakash Nadar27-Feb-04 13:40
Prakash Nadar27-Feb-04 13:40 
GeneralRe: Prob on Tasktray icons. Pin
SiddharthAtw27-Feb-04 20:05
SiddharthAtw27-Feb-04 20:05 
GeneralRe: Prob on Tasktray icons. Pin
Prakash Nadar28-Feb-04 0:22
Prakash Nadar28-Feb-04 0:22 

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.