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

C / C++ / MFC

 
AnswerRe: MFC OnInitDialog lengthy process halts screen painting Pin
Naveen31-Aug-07 5:11
Naveen31-Aug-07 5:11 
QuestionRe: MFC OnInitDialog lengthy process halts screen painting Pin
David Crow31-Aug-07 5:16
David Crow31-Aug-07 5:16 
QuestionVisual indication (Red, green) Pin
__yash__31-Aug-07 4:35
professional__yash__31-Aug-07 4:35 
AnswerRe: Visual indication (Red, green) Pin
Mark Salsbery31-Aug-07 5:02
Mark Salsbery31-Aug-07 5:02 
GeneralRe: Visual indication (Red, green) Pin
__yash__31-Aug-07 5:38
professional__yash__31-Aug-07 5:38 
GeneralRe: Visual indication (Red, green) Pin
Mark Salsbery31-Aug-07 5:48
Mark Salsbery31-Aug-07 5:48 
GeneralRe: Visual indication (Red, green) Pin
__yash__31-Aug-07 5:49
professional__yash__31-Aug-07 5:49 
GeneralRe: Visual indication (Red, green) Pin
Mark Salsbery31-Aug-07 6:13
Mark Salsbery31-Aug-07 6:13 
Here's some of the operations involved:

Add 2 icons to your app's resources - here I'll assume they are custom size
10x10 icons, with IDs IDI_INDICATORRED and IDI_INDICATORGREEN.
Draw the icons the way you want them to look.

Then...
// Add as member of window or dialog class
CStatic m_IndicatorStatic;
...

// In OnCreate() (for a window implementation) or OnInitDialog() (for a dialog implementation)...
//   (for a dialog, if the picture control is a resource on the dialog, and m_IndicatorStatic is already
//     associated with the control, then don't do the Create() call)

//  (Adjust passed CRect to properly position control in window's client area)
if (m_IndicatorStatic.Create(NULL, WS_CHILD | SS_ICON, CRect(0,0,10,10), this, ID_INDICATORSTATIC))
{
   m_IndicatorStatic.SetIcon((HICON)::LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_INDICATORRED), IMAGE_ICON, 10, 10, LR_SHARED));
}
...

// Later...Change the indicator to green
m_IndicatorStatic.SetIcon((HICON)::LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_INDICATORGREEN), IMAGE_ICON, 10, 10, LR_SHARED));

Hope that helps a bit!
Mark


Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: Visual indication (Red, green) Pin
__yash__31-Aug-07 6:24
professional__yash__31-Aug-07 6:24 
GeneralRe: Visual indication (Red, green) Pin
Mark Salsbery31-Aug-07 6:30
Mark Salsbery31-Aug-07 6:30 
GeneralRe: Visual indication (Red, green) Pin
__yash__31-Aug-07 6:34
professional__yash__31-Aug-07 6:34 
GeneralRe: Visual indication (Red, green) Pin
Mark Salsbery31-Aug-07 6:40
Mark Salsbery31-Aug-07 6:40 
GeneralRe: Visual indication (Red, green) Pin
__yash__31-Aug-07 6:47
professional__yash__31-Aug-07 6:47 
GeneralRe: Visual indication (Red, green) Pin
Mark Salsbery31-Aug-07 7:46
Mark Salsbery31-Aug-07 7:46 
GeneralRe: Visual indication (Red, green) Pin
Cedric Moonen31-Aug-07 6:15
Cedric Moonen31-Aug-07 6:15 
Questionhelp Pin
youbo31-Aug-07 4:07
youbo31-Aug-07 4:07 
QuestionRe: help Pin
Maximilien31-Aug-07 4:10
Maximilien31-Aug-07 4:10 
AnswerRe: help Pin
Russell'31-Aug-07 4:11
Russell'31-Aug-07 4:11 
GeneralRe: help Pin
youbo31-Aug-07 4:20
youbo31-Aug-07 4:20 
GeneralRe: help Pin
Russell'31-Aug-07 4:23
Russell'31-Aug-07 4:23 
GeneralRe: help Pin
Roger Broomfield31-Aug-07 5:45
Roger Broomfield31-Aug-07 5:45 
GeneralRe: help Pin
David Crow31-Aug-07 5:54
David Crow31-Aug-07 5:54 
GeneralRe: help Pin
Roger Broomfield31-Aug-07 6:02
Roger Broomfield31-Aug-07 6:02 
JokeRe: help Pin
Russell'31-Aug-07 6:14
Russell'31-Aug-07 6:14 
GeneralRe: help Pin
David Crow31-Aug-07 6:55
David Crow31-Aug-07 6:55 

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.