Click here to Skip to main content
15,889,838 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionBuilding / compiling DirectShow "empty DLL". Pin
Vaclav_23-Mar-14 5:51
Vaclav_23-Mar-14 5:51 
SuggestionRe: Building / compiling DirectShow "empty DLL". Pin
Richard MacCutchan23-Mar-14 22:59
mveRichard MacCutchan23-Mar-14 22:59 
QuestionWin CE program, SetFong() not work Pin
econy21-Mar-14 7:21
econy21-Mar-14 7:21 
AnswerRe: Win CE program, SetFong() not work Pin
Rage25-Mar-14 2:15
professionalRage25-Mar-14 2:15 
AnswerRe: Win CE program, SetFong() not work Pin
Rage25-Mar-14 2:17
professionalRage25-Mar-14 2:17 
GeneralRe: Win CE program, SetFong() not work Pin
econy25-Mar-14 3:32
econy25-Mar-14 3:32 
QuestionWidth of dropdown list window Pin
bokideclan21-Mar-14 2:33
bokideclan21-Mar-14 2:33 
QuestionVery weird change font problem Pin
econy20-Mar-14 8:18
econy20-Mar-14 8:18 
A dialog based program, I put a function to draw a string on the screen. the function is member function of TestDlg.h;
But if I put the function in TestDlg.cpp, the screen show some weird messy characters.
Then I put the same function in another cpp file, most of this file are global functions. JTest.cpp, with Jtest.h.
Weird thing is it works, screen can show correct characters.

Situation like:
C++
TestDlg.cpp
IMPLEMENT_DYNAMIC (CTestDlg,CDialog)
...
void TestDlg::DrawInfoLabel(void)
{
        CDC* 	pDC;		
	CRect	rect(562,448,688,467);	
	CString lebelStr;

	HDC hDC;					
	LOGFONT lf;		
	HFONT FontNew, FontOld;		

	pDC = GetDC();
	hDC = pDC->GetSafeHdc();

	memset(&lf, 0, sizeof(LOGFONT));	
	lf.lfHeight = -14 * GetDeviceCaps(hDC,LOGPIXELSY)/72;
	lf.lfWeight = 0;
	//WCHAR lffn[] = TEXT("SimSun(TrueType)"); 
	WCHAR lffn[] = TEXT("FZYaoTi(OpenType)"); 
	wcscpy(lf.lfFaceName,lffn);
	lf.lfCharSet = GB2312_CHARSET;
	FontNew = CreateFontIndirect(&lf);
	FontOld = (HFONT)SelectObject(hDC,FontNew);

	pDC->SetTextColor(RGB(0xFF,0x00,0x00));
	SetBkMode(hDC,TRANSPARENT);

	DrawText(hDC,_T("??"),-1,rect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);

	SelectObject(hDC,FontOld);
	DeleteObject(FontNew);
	ReleaseDC(pDC);
}


In JTest.cpp
C++
void TestDlg::DrawInfoLabel(void)
{
....
} 


Every line is same, only difference is file name. I feel it is the following statement affect the screen output.
IMPLEMENT_DYNAMIC (CTestDlg,CDialog)

C++
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "newres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE 
BEGIN
    "#include ""afxres.h""\r\n"
    "#include ""newres.h""\r\n"
    "\0"
END
........

The above is .rc file.

Hope someone can explain that.
Thanks in advance
QuestionRe: Very weird change font problem Pin
Randor 20-Mar-14 8:43
professional Randor 20-Mar-14 8:43 
AnswerRe: Very weird change font problem Pin
econy20-Mar-14 9:00
econy20-Mar-14 9:00 
AnswerRe: Very weird change font problem Pin
Randor 20-Mar-14 10:22
professional Randor 20-Mar-14 10:22 
GeneralRe: Very weird change font problem Pin
econy20-Mar-14 10:33
econy20-Mar-14 10:33 
AnswerRe: Very weird change font problem Pin
Randor 20-Mar-14 10:51
professional Randor 20-Mar-14 10:51 
GeneralRe: Very weird change font problem Pin
econy20-Mar-14 13:20
econy20-Mar-14 13:20 
QuestionSetfont() not work Pin
econy20-Mar-14 5:38
econy20-Mar-14 5:38 
AnswerRe: Setfont() not work Pin
Randor 20-Mar-14 8:35
professional Randor 20-Mar-14 8:35 
GeneralRe: Setfont() not work Pin
econy20-Mar-14 8:42
econy20-Mar-14 8:42 
QuestionCEdit GetRect() question Pin
econy20-Mar-14 4:02
econy20-Mar-14 4:02 
AnswerRe: CEdit GetRect() question Pin
econy20-Mar-14 6:38
econy20-Mar-14 6:38 
QuestionCDatabase::ExecuteSQL Pin
Fawaz Ajani19-Mar-14 22:33
Fawaz Ajani19-Mar-14 22:33 
SuggestionRe: CDatabase::ExecuteSQL Pin
Richard MacCutchan19-Mar-14 23:22
mveRichard MacCutchan19-Mar-14 23:22 
GeneralRe: CDatabase::ExecuteSQL Pin
Fawaz Ajani20-Mar-14 1:55
Fawaz Ajani20-Mar-14 1:55 
GeneralRe: CDatabase::ExecuteSQL Pin
Richard MacCutchan20-Mar-14 2:33
mveRichard MacCutchan20-Mar-14 2:33 
GeneralRe: CDatabase::ExecuteSQL Pin
Fawaz Ajani20-Mar-14 5:49
Fawaz Ajani20-Mar-14 5:49 
GeneralRe: CDatabase::ExecuteSQL Pin
David Crow20-Mar-14 3:17
David Crow20-Mar-14 3:17 

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.