win32 and a STM_SETICON (STM_SETIMAGE) problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

win32 and a STM_SETICON (STM_SETIMAGE) problem

Thomas Steinbach
Hello,

if I load an Icon from a file with

hIcon1 = (HICON)LoadImage(GetModuleHandle(0), "myicon.ico", IMAGE_ICON, 0,
0, LR_LOADFROMFILE);
http://msdn.microsoft.com/en-us/library/ms648045(VS.85).aspx

I can't set this Icon with STM_SETICON to a static (icon) control with

SendDlgItemMessage(hWnd, IDC_STATIC_ICON, STM_SETICON,
(WPARAM)(HICON)hIcon1, 0);
http://msdn.microsoft.com/en-us/library/cc656592(VS.85).aspx

The control is defined like:

ICON "",IDC_STATIC_ICON,14,14,20,20,SS_CENTERIMAGE

Why? And what do I have to do to get this working?


And this doesn't work no longer: :-(

IDI_ICON_APP      ICON    "myicon.ico"

ICON "IDI_ICON_APP ",IDC_STATIC,14,14,20,20,SS_CENTERIMAGE

the Icon is not visible after compiling, but the file is accessable and the
hIcon2 (see below) are valid and can be set with WM_SETICON to the
windows small icon if I do it with:

hIcon2 = LoadIcon(GetModuleHandle(0),
(LPCTSTR)MAKEINTRESOURCE(IDI_ICON_APP));
SendMessage(hWnd, WM_SETICON, (WPARAM)FALSE, (LPARAM)hIcon2);

http://msdn.microsoft.com/en-us/library/ms648072(VS.85).aspx


It's Fat32 patition where the file is running form and shouldn't be
a restriction/right problem.
With the ms compiler of VS2008 it's working fine, but not
with gcc of mingw :-(

Why? And how can I get this running?

The Icons have three icons 1.) 48x48, 2.) 32x32 and 3.) 16x16
all with 256 colors

Can the size of the first Icon (48x48) be a problem?

But it was working before I tried to set an another Icon which I load
from a file... :-(

Hope that somebody can help me or have an idea what is the
problem

Thomas


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming
Reply | Threaded
Open this post in threaded view
|

Re: win32 and a STM_SETICON (STM_SETIMAGE) problem

Alessandro Antonello
In fact. I never been able to make this think work as Microsoft says it works.
If you need to use a STATIC control that shows an icon image you should use:

CTEXT   IDC_IDENTIFIER, x, y, cx, cy, SS_ICON | SS_CENTERIMAGE |
SS_REALSIZEIMAGE

Afte that you can use LoadImage()/SendMessage() pair to set the icon.

Best regards,
Alessandro Antonello.


2009/1/30 Thomas Steinbach

> Hello,
>
> if I load an Icon from a file with
>
> hIcon1 = (HICON)LoadImage(GetModuleHandle(0), "myicon.ico", IMAGE_ICON, 0,
> 0, LR_LOADFROMFILE);
> http://msdn.microsoft.com/en-us/library/ms648045(VS.85).aspx
>
> I can't set this Icon with STM_SETICON to a static (icon) control with
>
> SendDlgItemMessage(hWnd, IDC_STATIC_ICON, STM_SETICON,
> (WPARAM)(HICON)hIcon1, 0);
> http://msdn.microsoft.com/en-us/library/cc656592(VS.85).aspx
>
> The control is defined like:
>
> ICON "",IDC_STATIC_ICON,14,14,20,20,SS_CENTERIMAGE
>
> Why? And what do I have to do to get this working?
>
>
> And this doesn't work no longer: :-(
>
> IDI_ICON_APP      ICON    "myicon.ico"
>
> ICON "IDI_ICON_APP ",IDC_STATIC,14,14,20,20,SS_CENTERIMAGE
>
> the Icon is not visible after compiling, but the file is accessable and the
> hIcon2 (see below) are valid and can be set with WM_SETICON to the
> windows small icon if I do it with:
>
> hIcon2 = LoadIcon(GetModuleHandle(0),
> (LPCTSTR)MAKEINTRESOURCE(IDI_ICON_APP));
> SendMessage(hWnd, WM_SETICON, (WPARAM)FALSE, (LPARAM)hIcon2);
>
> http://msdn.microsoft.com/en-us/library/ms648072(VS.85).aspx
>
>
> It's Fat32 patition where the file is running form and shouldn't be
> a restriction/right problem.
> With the ms compiler of VS2008 it's working fine, but not
> with gcc of mingw :-(
>
> Why? And how can I get this running?
>
> The Icons have three icons 1.) 48x48, 2.) 32x32 and 3.) 16x16
> all with 256 colors
>
> Can the size of the first Icon (48x48) be a problem?
>
> But it was working before I tried to set an another Icon which I load
> from a file... :-(
>
> Hope that somebody can help me or have an idea what is the
> problem
>
> Thomas
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> MinGW-users mailing list
> [hidden email]
>
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users
>
> _______________________________________________
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same.
>
> Most annoying abuses are:
> 1) Top posting
> 2) HTML/MIME encoded mail
> 3) Improper quoting
> 4) Improper trimming
>



--
Alessandro Antonello

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming