hi all,

i'm quite sure is possible...

i would like a small icon in my dialog, to use it as a flag indicator, better if created in the resource file.

In the resource file now i have

ICON IDI_C_YES, IDC_STATIC, 350, 9, 8, 8, 0x00000200, 0

And changing bits of the style i can see my icon change.. i can change the sides size but the icon come cutted.. i still haven't found the right style to scale as little icon (if it exist) ....



If any help THX B7 :)
Posted on 2003-04-06 15:34:55 by Bit7

i have a dream: to live the little things of every day, as a coffe @ the bar and so on. And if you enjoy the little things, maybe one day could also arrive the big things. (Omar, a friend of mine)
Mullah Omar? :grin:

PS: sorry, can't help with your question. :(
Posted on 2003-04-06 15:50:21 by Maverick
have you tried to send WM_SETICON message to your dialog?
here is MSDN quote

WM_SETICON
An application sends the WM_SETICON message to associate a new large or small icon with a window. The system displays the large icon in the ALT+TAB dialog, and the small icon in the window caption.

WM_SETICON
wParam = (WPARAM) fType; // icon type
lParam = (LPARAM) (HICON) hicon; // handle to icon

Parameters
fType
Value of wParam. Specifies the type of icon being set. This parameter can be one of the following values: Value Meaning
ICON_BIG Set the large icon for the window.
ICON_SMALL Set the small icon for the window.

hicon
Value of lParam. Handle to the new large or small icon. If this parameter is NULL, the icon indicated by fType is removed.
Return Values
The return value is a handle to the previous large or small icon, depending on the value of fType. It is NULL if the window previously had no icon of the type indicated by fType.

Default Action
The DefWindowProc function returns a handle to the previous large or small icon associated with the window, depending on the value of fType.

QuickInfo
Windows NT: Requires version 4.0 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winuser.h.

Posted on 2003-04-06 20:34:14 by Mikky
mav,

hahahah, my friend omar will be happy of this new name :)



mikky,

thanks, if no other chance i will try your way, but i was really triyng to do it just from the resource file...

B7
Posted on 2003-04-07 08:41:32 by Bit7
I will do it from MS VC IDE when I come home and copy paste the resulting source...
Posted on 2003-04-07 10:45:22 by JCP


IDI_DIALOGTEST ICON DISCARDABLE "dialogtest.ICO"


/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 230, 75
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 8, "System"
BEGIN
ICON IDI_DIALOGTEST,IDC_MYICON,14,9,16,16
LTEXT "dialogtest Version 1.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX
LTEXT "Copyright (C) 2003",IDC_STATIC,49,20,119,8
DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP
END


But it seems that you already found that...
If I understand your problem : you want to display the icon in 16*16 ?
Posted on 2003-04-07 16:50:22 by JCP
Im confused what he wants...

But i can put an icon on a dialog box with this:

   invoke LoadIcon, hInstance, 600 

mov hIcon, eax
invoke SetClassLong, hWnd, GCL_HICON, hIcon


Where in the resource file:

"600 ICON DISCARDABLE "mainicon.ico"

Hope it helps..
:alright:
NaN
Posted on 2003-04-07 19:24:56 by NaN
Yeah, but I think he wants to do it from the resource directly...
Resources files allows to do that, but it does not seem to work for 16*16 icons... :o
Posted on 2003-04-08 01:47:42 by JCP
NaN, wont that put the icon on *all* the dialogs in your process?
Posted on 2003-04-08 02:17:31 by f0dder
sorry for may bad explain.. :(

Yes i would like an icon in the dialog, just from the resource file.
But i would like the icon in a small size (as the one in the caption bar). I don't know the exact size, maybe 16x16 or less.

ICON IDI_C_YES, IDC_STATIC, 350, 9, 8, 8, STYLE, 0

But don't waste time, probably thai is not possible. Altought if i've seen that playing with the style bits i get vbar and hbar, an whit these 2 styles the icon come resized in a small size but the bar remains...


B7
Posted on 2003-04-08 05:47:51 by Bit7
Done ! here we go :alright:

there's no much "asm related" on this i agree .. but could be useful, now i close it !


If someone has interests on put on the dialog, in a particular place (not the caption bar) a small icon (smaller than 32x32 pixel), for example 16x16, same size of caption bar icon, it's easy. All can be done only from the resource file:

ICON IDI_C_YES, IDC_STATIC, 350, 15, 12, 12, 0x00000a00, 0

0x00000a00: this style display only a part of the icon, starting from the center of the icon space:
if you define, as in my example, 12, 12 as width and height, it will display the center part of your icon, but 16x16 (YourWidth+4, YourHeight+4).

So if you prepare a reduced size icon (16x16, centered on the 32x32 space) masked with transparent color outside of the circle, you can put it on the dialog as small icon.

Yes it's a workaround but work nice. If you need some 'flag purpose' small icon in the dialog is better that bitblt it !
And you can display or not just as Visible or not.

Hi B7 i love icons :)
Posted on 2003-04-10 17:01:55 by Bit7
Only one little question... Why didn't you use a 16x16 bitmap instead of an icon?
Posted on 2003-04-11 07:17:51 by LuHa
Luha, mmmh, i dind't try it. Maybe it seems easier with icon, since i want a round shape, and icon have already the transparence as effect.
Posted on 2003-04-11 14:57:50 by Bit7
You can use LoadImage with LR_LOADMAP3DCOLORS or LR_LOADTRANSPARENT flags, but only if you have a standard uniform background.
Posted on 2003-04-14 10:34:51 by LuHa
thx luha,

i will try this. But the icon method is nice since you don't need to load nothing, is all from the resource and naturally transparent. Then in the code just do ShowWindow to show or not the icon flag :) .
Posted on 2003-04-14 16:13:53 by Bit7