Icon not showing in CStatic Control
-
Hi, I am programming a custom error dialog box with two three CStatic Controls. The first is a title, the second is a message and the third is a picture box set to be a icon. The first two are okay. The third is really bugging me! I've created a variable for the CStatic from the Variable Wizard called m_Icon and then in Init_Dialg I set it to a standard Icon using this:
m_Icon.SetIcon(AfxGetApp()->LoadStandardIcon(IDI_EXCLAMATION));
I have also tried creating an Icon using HICON and setting the control to the HICON and using the methodm_Icon.SetIcon(::LoadIcon(IDI_EXCLAMATION));
They all compile fine. But when i the app runs, i dont see the Icon. The Controls Visability is set to TRUE. Where have I gone wrong and how can I correct this? Many Thanks Tom. P.S Personally creating Custom Error Dialogs is a pain, and I am looking forward to seeing the Windows Vista TaskDialog!! :cool: ;) -- modified at 16:09 Sunday 22nd January, 2006 -
Hi, I am programming a custom error dialog box with two three CStatic Controls. The first is a title, the second is a message and the third is a picture box set to be a icon. The first two are okay. The third is really bugging me! I've created a variable for the CStatic from the Variable Wizard called m_Icon and then in Init_Dialg I set it to a standard Icon using this:
m_Icon.SetIcon(AfxGetApp()->LoadStandardIcon(IDI_EXCLAMATION));
I have also tried creating an Icon using HICON and setting the control to the HICON and using the methodm_Icon.SetIcon(::LoadIcon(IDI_EXCLAMATION));
They all compile fine. But when i the app runs, i dont see the Icon. The Controls Visability is set to TRUE. Where have I gone wrong and how can I correct this? Many Thanks Tom. P.S Personally creating Custom Error Dialogs is a pain, and I am looking forward to seeing the Windows Vista TaskDialog!! :cool: ;) -- modified at 16:09 Sunday 22nd January, 2006LoadStandardIcon()
takes aLPCTSTR
, not anUINT
. Use theMAKEINTRESOURCE
macro to convert IDI_EXCLAMATION to anLPCTSTR
.m_Icon.SetIcon(AfxGetApp()->LoadStandardIcon(MAKEINTRESOURCE(IDI_EXCLAMATION));
::LoadIcon
takes two parameters, the first of which is the handle to the applications's instance, orNULL
if loading standard icons. I am surprised the code even compiled.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!
-
LoadStandardIcon()
takes aLPCTSTR
, not anUINT
. Use theMAKEINTRESOURCE
macro to convert IDI_EXCLAMATION to anLPCTSTR
.m_Icon.SetIcon(AfxGetApp()->LoadStandardIcon(MAKEINTRESOURCE(IDI_EXCLAMATION));
::LoadIcon
takes two parameters, the first of which is the handle to the applications's instance, orNULL
if loading standard icons. I am surprised the code even compiled.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!
Actually,
IDI_EXCLAMATION
is defined inwinuser.h
usingMAKEINTRESOURCE()
, so it's not needed here.Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
Hi, I am programming a custom error dialog box with two three CStatic Controls. The first is a title, the second is a message and the third is a picture box set to be a icon. The first two are okay. The third is really bugging me! I've created a variable for the CStatic from the Variable Wizard called m_Icon and then in Init_Dialg I set it to a standard Icon using this:
m_Icon.SetIcon(AfxGetApp()->LoadStandardIcon(IDI_EXCLAMATION));
I have also tried creating an Icon using HICON and setting the control to the HICON and using the methodm_Icon.SetIcon(::LoadIcon(IDI_EXCLAMATION));
They all compile fine. But when i the app runs, i dont see the Icon. The Controls Visability is set to TRUE. Where have I gone wrong and how can I correct this? Many Thanks Tom. P.S Personally creating Custom Error Dialogs is a pain, and I am looking forward to seeing the Windows Vista TaskDialog!! :cool: ;) -- modified at 16:09 Sunday 22nd January, 2006Does your static control have the
SS_ICON
style set?Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"