Click here to Skip to main content
15,898,939 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Calling Webservice through VC++ Pin
sunit51-Aug-05 3:06
sunit51-Aug-05 3:06 
GeneralRe: Calling Webservice through VC++ Pin
Ravi Bhavnani1-Aug-05 7:41
professionalRavi Bhavnani1-Aug-05 7:41 
GeneralWindows Message Hook Crashes Pin
nick1131-Jul-05 19:02
nick1131-Jul-05 19:02 
GeneralRe: Windows Message Hook Crashes Pin
Alexander M.,1-Aug-05 1:08
Alexander M.,1-Aug-05 1:08 
GeneralRe: Windows Message Hook Crashes Pin
nick111-Aug-05 17:49
nick111-Aug-05 17:49 
GeneralBuild MFC Pin
LiYS31-Jul-05 17:03
LiYS31-Jul-05 17:03 
GeneralRe: Build MFC Pin
Christian Graus31-Jul-05 20:04
protectorChristian Graus31-Jul-05 20:04 
GeneralRe: Build MFC Pin
Alexander M.,1-Aug-05 1:17
Alexander M.,1-Aug-05 1:17 
GeneralExecute Button Pin
Ista31-Jul-05 16:14
Ista31-Jul-05 16:14 
GeneralRe: Execute Button Pin
Ista1-Aug-05 9:28
Ista1-Aug-05 9:28 
GeneralDameged files Pin
Aqueel31-Jul-05 15:41
Aqueel31-Jul-05 15:41 
GeneralRe: Dameged files Pin
Christian Graus31-Jul-05 20:05
protectorChristian Graus31-Jul-05 20:05 
QuestionHow to access the I/O port under Windows2000 Pin
pantao55131-Jul-05 15:23
pantao55131-Jul-05 15:23 
AnswerRe: How to access the I/O port under Windows2000 Pin
Abbas_Riazi31-Jul-05 20:05
professionalAbbas_Riazi31-Jul-05 20:05 
AnswerRe: How to access the I/O port under Windows2000 Pin
Marc Soleda31-Jul-05 20:53
Marc Soleda31-Jul-05 20:53 
GeneralStatus bar problem Pin
TEOlivier31-Jul-05 10:57
TEOlivier31-Jul-05 10:57 
GeneralImages in Rich edit Pin
Aqueel31-Jul-05 8:06
Aqueel31-Jul-05 8:06 
GeneralRe: Images in Rich edit Pin
Trollslayer31-Jul-05 8:57
mentorTrollslayer31-Jul-05 8:57 
GeneralTrouble getting device context Pin
theFrenchHornet31-Jul-05 7:41
theFrenchHornet31-Jul-05 7:41 
I don't know how to correctly acquire the device context for a control. If I put similar code in the OnCtlColor routine where a pointer to the device context is provided, the code works. However, when I try setting the device context, the code doesn't work. Two samples are provided - the first is the code that doesn't work. I appreciate any help fixing it. Thank-you.

This code compiles and runs without error, but does not achieve the color change. (c_navValid is a text box control)
LOGFONT lf;
CDC* dc = new CDC;
dc->Attach(c_navValid.GetDC()->m_hDC);
         
GetFont()->GetObject(sizeof(lf), &lf);
font.CreateFontIndirect(&lf);

dc->SelectObject(&font);
dc->SetTextColor(RGB(0,100,0));
font.DeleteObject();

This code works.
HBRUSH CNavDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
 W_Position_Data_Type* pPositionMsg;
 pPositionMsg = (W_Position_Data_Type*)&CInMsgs::wPositionMsg;
	
 HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);

 if (pWnd->GetDlgCtrlID() == IDC_NAV_VALID)
 {
   if (pPositionMsg->Mode_Word.Nav_Valid)
   {
     LOGFONT lf;
     GetFont()->GetObject(sizeof(lf), &lf);
     font.CreateFontIndirect(&lf);
     pDC->SelectObject(&font);
     pDC->SetTextColor(RGB(0,100,0));
     font.DeleteObject();
   }
 }

GeneralRe: Trouble getting device context Pin
Michael Dunn31-Jul-05 19:56
sitebuilderMichael Dunn31-Jul-05 19:56 
GeneralRe: Trouble getting device context Pin
theFrenchHornet1-Aug-05 5:23
theFrenchHornet1-Aug-05 5:23 
GeneralEmbedding Text into PDF Pin
Abbas_Riazi31-Jul-05 1:16
professionalAbbas_Riazi31-Jul-05 1:16 
GeneralFinding the modem Pin
Y_R30-Jul-05 23:19
Y_R30-Jul-05 23:19 
GeneralRe: Finding the modem Pin
Abbas_Riazi31-Jul-05 1:18
professionalAbbas_Riazi31-Jul-05 1:18 
GeneralRe: Finding the modem Pin
Y_R31-Jul-05 10:32
Y_R31-Jul-05 10:32 

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.