SetIcon Error / Exception
-
I have a MDI application where, i am using a picture control to load icons of leds. The goal is to load the picture control with ICON that look like leds green and red. However, I am getting a Debug Assertion Failed where i set the new icon value. iconPitchActiveFault is CStatic control variable for a ICON void Lenze8200_Dlg::OnShowWindow(BOOL bShow, UINT nStatus) { CFormView::OnShowWindow(bShow, nStatus); //UpdateData(TRUE); HICON Red_ON; HICON Red_OFF; HICON Green_ON; HICON Green_OFF; // TODO: Add your message handler code here Red_ON = AfxGetApp()->LoadIcon(IDI_RED_ON_LED); Red_OFF = AfxGetApp()->LoadIcon(IDI_OFF_LED); Green_ON = AfxGetApp()->LoadIcon(IDI_GREEN_ON_LED); Green_OFF = AfxGetApp()->LoadIcon(IDI_OFF_LED); ******** The exceptions shows up here ************** m_iconPitchActiveFault.SetIcon( Red_OFF ); }
Scott Dolan Jernie Corporation Engineering & Manufacturing Software, Hardware, & Enclosures
-
I have a MDI application where, i am using a picture control to load icons of leds. The goal is to load the picture control with ICON that look like leds green and red. However, I am getting a Debug Assertion Failed where i set the new icon value. iconPitchActiveFault is CStatic control variable for a ICON void Lenze8200_Dlg::OnShowWindow(BOOL bShow, UINT nStatus) { CFormView::OnShowWindow(bShow, nStatus); //UpdateData(TRUE); HICON Red_ON; HICON Red_OFF; HICON Green_ON; HICON Green_OFF; // TODO: Add your message handler code here Red_ON = AfxGetApp()->LoadIcon(IDI_RED_ON_LED); Red_OFF = AfxGetApp()->LoadIcon(IDI_OFF_LED); Green_ON = AfxGetApp()->LoadIcon(IDI_GREEN_ON_LED); Green_OFF = AfxGetApp()->LoadIcon(IDI_OFF_LED); ******** The exceptions shows up here ************** m_iconPitchActiveFault.SetIcon( Red_OFF ); }
Scott Dolan Jernie Corporation Engineering & Manufacturing Software, Hardware, & Enclosures
-
I have a MDI application where, i am using a picture control to load icons of leds. The goal is to load the picture control with ICON that look like leds green and red. However, I am getting a Debug Assertion Failed where i set the new icon value. iconPitchActiveFault is CStatic control variable for a ICON void Lenze8200_Dlg::OnShowWindow(BOOL bShow, UINT nStatus) { CFormView::OnShowWindow(bShow, nStatus); //UpdateData(TRUE); HICON Red_ON; HICON Red_OFF; HICON Green_ON; HICON Green_OFF; // TODO: Add your message handler code here Red_ON = AfxGetApp()->LoadIcon(IDI_RED_ON_LED); Red_OFF = AfxGetApp()->LoadIcon(IDI_OFF_LED); Green_ON = AfxGetApp()->LoadIcon(IDI_GREEN_ON_LED); Green_OFF = AfxGetApp()->LoadIcon(IDI_OFF_LED); ******** The exceptions shows up here ************** m_iconPitchActiveFault.SetIcon( Red_OFF ); }
Scott Dolan Jernie Corporation Engineering & Manufacturing Software, Hardware, & Enclosures
Is it an exception or an assertion?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
I have a MDI application where, i am using a picture control to load icons of leds. The goal is to load the picture control with ICON that look like leds green and red. However, I am getting a Debug Assertion Failed where i set the new icon value. iconPitchActiveFault is CStatic control variable for a ICON void Lenze8200_Dlg::OnShowWindow(BOOL bShow, UINT nStatus) { CFormView::OnShowWindow(bShow, nStatus); //UpdateData(TRUE); HICON Red_ON; HICON Red_OFF; HICON Green_ON; HICON Green_OFF; // TODO: Add your message handler code here Red_ON = AfxGetApp()->LoadIcon(IDI_RED_ON_LED); Red_OFF = AfxGetApp()->LoadIcon(IDI_OFF_LED); Green_ON = AfxGetApp()->LoadIcon(IDI_GREEN_ON_LED); Green_OFF = AfxGetApp()->LoadIcon(IDI_OFF_LED); ******** The exceptions shows up here ************** m_iconPitchActiveFault.SetIcon( Red_OFF ); }
Scott Dolan Jernie Corporation Engineering & Manufacturing Software, Hardware, & Enclosures
As soon as a window is created, many different messages, including
WM_SHOWWINDOW
will start flying. But just because the parent window is created, doesn't mean its children are also alive and well. You can avoid this problem by making liberal use ofIsWindow()
:if (::IsWindow(m\_iconPitchActiveFault.m\_hWnd)) m\_iconPitchActiveFault.SetIcon( Red\_OFF );
Best wishes, Hans
-
I have a MDI application where, i am using a picture control to load icons of leds. The goal is to load the picture control with ICON that look like leds green and red. However, I am getting a Debug Assertion Failed where i set the new icon value. iconPitchActiveFault is CStatic control variable for a ICON void Lenze8200_Dlg::OnShowWindow(BOOL bShow, UINT nStatus) { CFormView::OnShowWindow(bShow, nStatus); //UpdateData(TRUE); HICON Red_ON; HICON Red_OFF; HICON Green_ON; HICON Green_OFF; // TODO: Add your message handler code here Red_ON = AfxGetApp()->LoadIcon(IDI_RED_ON_LED); Red_OFF = AfxGetApp()->LoadIcon(IDI_OFF_LED); Green_ON = AfxGetApp()->LoadIcon(IDI_GREEN_ON_LED); Green_OFF = AfxGetApp()->LoadIcon(IDI_OFF_LED); ******** The exceptions shows up here ************** m_iconPitchActiveFault.SetIcon( Red_OFF ); }
Scott Dolan Jernie Corporation Engineering & Manufacturing Software, Hardware, & Enclosures
How do you make m_iconPitchActiveFault?
WhiteSky