Click here to Skip to main content
15,892,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Serialization Pin
toxcct23-Aug-06 21:27
toxcct23-Aug-06 21:27 
QuestionRe: Serialization Pin
David Crow24-Aug-06 3:13
David Crow24-Aug-06 3:13 
QuestionAdding a COM reference in vc++ .net Pin
tmoney10123-Aug-06 15:46
tmoney10123-Aug-06 15:46 
AnswerRe: Adding a COM reference in vc++ .net Pin
jk chan23-Aug-06 16:21
jk chan23-Aug-06 16:21 
AnswerRe: Adding a COM reference in vc++ .net Pin
prasad_som23-Aug-06 19:24
prasad_som23-Aug-06 19:24 
GeneralRe: Adding a COM reference in vc++ .net Pin
tmoney10123-Aug-06 20:14
tmoney10123-Aug-06 20:14 
GeneralRe: Adding a COM reference in vc++ .net Pin
prasad_som23-Aug-06 20:44
prasad_som23-Aug-06 20:44 
Questionreading the active font in a window Pin
phani_8923-Aug-06 15:21
phani_8923-Aug-06 15:21 
Hi ,
I need to read the active font in the present forground window, which i trying
to do with the below sample code. But every time i execute the "GetTextFace" i get the
Font Name as "System ". I kept the foreground window as the "note pad" and if this
program is executed i always get the Font name as "system".

{
HFONT m_font;
int buf_size = 10000;

char* m_gbuf = new char [buf_size];
MAT2 m_mat2;
unsigned char chr= 'L';
int total_size ;
int divider =0;
RECT MsgRect;


memset(&m_mat2, 0, sizeof(m_mat2));
m_mat2.eM11.value = 1;
m_mat2.eM22.value = 1;

TEXTMETRIC *lptm = new TEXTMETRIC;
LOGFONT *lplf = new LOGFONT;

hwnd = GetForegroundWindow();
m_dc = GetDC(hwnd);

GetTextFace(m_dc, buf_size, m_gbuf);
printf(" %s \n ",m_gbuf);

GetTextMetrics( m_dc, lptm);

lplf->lfCharSet = ANSI_CHARSET;
strncpy(lplf->lfFaceName, m_gbuf, sizeof(m_gbuf));
lplf->lfHeight = lptm->tmHeight;
lplf->lfItalic = lptm->tmItalic;
lplf->lfUnderline = lptm->tmUnderlined;
lplf->lfStrikeOut = lptm->tmStruckOut;
lplf->lfPitchAndFamily = lptm->tmPitchAndFamily;
lplf->lfWeight = lptm->tmWeight;
lplf->lfWidth = lptm->tmAveCharWidth;
lplf->lfClipPrecision =0;
lplf->lfEscapement = 0;
lplf->lfOrientation = 0;
lplf->lfQuality = 0;
lplf->lfOutPrecision = 0;

m_font = CreateFontIndirect(lplf);

if(m_font == NULL)
printf("failed ");

SelectObject(m_dc, m_font);

GLYPHMETRICS gm;

chr= '1';
total_size = GetGlyphOutline(m_dc, chr, GGO_GRAY2_BITMAP, &gm, buf_size, (void*)m_gbuf, &m_mat2);

}

Can anyone please help, to capture the Font that is active in a Specified Window if we know the handle of that window.

I dont know much abt fonts and i am sure that i am terribly missing something, please help.

Thanks in Advance..

AnswerRe: reading the active font in a window Pin
Waldermort23-Aug-06 15:44
Waldermort23-Aug-06 15:44 
AnswerRe: reading the active font in a window Pin
jk chan23-Aug-06 16:26
jk chan23-Aug-06 16:26 
GeneralRe: reading the active font in a window Pin
phani_8926-Aug-06 1:38
phani_8926-Aug-06 1:38 
JokeI wrote a JumpTigger(or you may call it webspider) for Windows Live Space~ Pin
Artex_xh23-Aug-06 13:45
Artex_xh23-Aug-06 13:45 
GeneralRe: I wrote a JumpTigger(or you may call it webspider) for Windows Live Space~ Pin
Rage23-Aug-06 21:19
professionalRage23-Aug-06 21:19 
QuestionIs it possible to send files through Telnet? Pin
Lord Kixdemp23-Aug-06 13:40
Lord Kixdemp23-Aug-06 13:40 
AnswerRe: Is it possible to send files through Telnet? Pin
Mike Dimmick23-Aug-06 13:55
Mike Dimmick23-Aug-06 13:55 
QuestionSemaphore count Pin
Julberto Danray23-Aug-06 10:56
Julberto Danray23-Aug-06 10:56 
AnswerRe: Semaphore count Pin
Michael Dunn23-Aug-06 12:13
sitebuilderMichael Dunn23-Aug-06 12:13 
AnswerRe: Semaphore count Pin
Julberto Danray23-Aug-06 14:10
Julberto Danray23-Aug-06 14:10 
AnswerRe: Semaphore count Pin
Joe Woodbury23-Aug-06 12:17
professionalJoe Woodbury23-Aug-06 12:17 
GeneralRe: Semaphore count Pin
Julberto Danray23-Aug-06 16:16
Julberto Danray23-Aug-06 16:16 
GeneralRe: Semaphore count Pin
Joe Woodbury23-Aug-06 16:45
professionalJoe Woodbury23-Aug-06 16:45 
AnswerRe: Semaphore count Pin
tyftyftyf22-Nov-09 16:03
tyftyftyf22-Nov-09 16:03 
QuestionDoes anybody recognise this... Pin
Waldermort23-Aug-06 10:36
Waldermort23-Aug-06 10:36 
AnswerRe: Does anybody recognise this... Pin
Rick York23-Aug-06 11:29
mveRick York23-Aug-06 11:29 
GeneralRe: Does anybody recognise this... Pin
Waldermort23-Aug-06 12:42
Waldermort23-Aug-06 12:42 

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.