ICON to CButton

Hello,
I'm using VC6++ and MFC. I have created a CButton with property Symbol and I want to display an Icon on that Button.
The Icon is for example the normal trash icon from windows (its included to resources as IDI_TRASH
But it does not work to do the following:
HINSTANCE hInst;
HICON TEST;
TEST = LoadIcon(hInst, LPCTSTR(IDI_TRASH);
m_TEST.SetIcon(TEST);
UpdateData(TRUE);
What did I wrong?
MIKE2SAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nietodCommented:
Did you test to see if LoadIncon() returned a non-NULL handle?

Do you initialize hInst?  It looks like you don't.
0
MIKE2SAuthor Commented:
No I didn't init hInst. How to init?
Yes loadicon returns with a NULL.

0
nietodCommented:
The first parameter to LoadIcon is an instance handle to the module that contains the resource you want to load.   A modlue is either an EXE or DLL)  So you need to know what EXE/DLL specifies the resource.  Do you?  There is one other posibility, if the resource is from the OS, that is, it was not created by you and is not stored in your EXE/DLL, then specify NULL for this

Does that help you locate it?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MIKE2SAuthor Commented:
Yes it works!!
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.