• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1498
  • Last Modified:

WM_SETICON

Hi,
I have this call in my app :


SendMessage(hwnd, WM_SETICON,WPARAM (ICON_SMALL), (LPARAM)LoadImage(0, "c:\\myfile.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE));

But my compiler says
Fehler:  WM_seticon.cpp(16,52):Undefined symbol 'ICON_SMALL'

I have included windows.h so wheres the problem?
0
Scotchman
Asked:
Scotchman
  • 4
  • 4
1 Solution
 
AlexFMCommented:
You possibly don't have latest SDK headers. Use these values:

#define ICON_SMALL          0
#define ICON_BIG            1

0
 
ScotchmanAuthor Commented:
you were right, but nothing happens???
0
 
AlexFMCommented:
LPARAM should be HICON. I think you need IMAGE_ICON parameter of LoadImage.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
ScotchmanAuthor Commented:
wht do you mean with IMAGE ICON Parameter of LoadImage?
Can you give me an example please?
0
 
ScotchmanAuthor Commented:
oh,sorry now I know what you meen...
I tried it with the IMAGE_ICON parameter, but still nothing happens.....
0
 
AlexFMCommented:
First create valid icon handle:

HICON hIcon = LoadImage(...);

Be sure that icon is loaded. After this send WM_SETICON message.
0
 
ScotchmanAuthor Commented:
Its changing now, but as soon as I minimize it or change the focus away and back to the window the icon is the old one again!?
0
 
AlexFMCommented:
Maybe to do it persistent you need to set this icon when window created (see RegisterClass, WNDCLASS).
0
 
bcladdCommented:
No comment has been added lately, so it's time to clean up this TA. I will
leave a recommendation in the Cleanup topic area that this question is:

Answered: Points to AlexFM: Grade A

Please leave any comments here within the next seven days.

Experts: Silence means you don't care. Grading recommendations are made in light
of the posted grading guidlines (http://www.experts-exchange.com/help.jsp#hi73).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

-bcl (bcladd)
EE Cleanup Volunteer
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now