IonicWind Software

IWBasic => General Questions => Topic started by: Andy on December 01, 2020, 11:48:54 PM

Title: SETICON Question
Post by: Andy on December 01, 2020, 11:48:54 PM
I have my main window (w1) set with an icon.

hIcon[1] = LOADIMAGE(GETSTARTPATH + "\Res\\editor.ico", @IMGICON)
SETICON w1,hIcon[1]

In the File menu when you select one of the options, it opens up a second screen (w17) - which is not a child window.

I now set this second screen's icon with a different one...

hIcon[2] = LOADIMAGE(GETSTARTPATH + "\Res\\books.ico", @IMGICON)
SETICON w17,hIcon[2]

But when I open this second screen (w17) it changes the icon for my main screen to the "books.ico".

The question is why?

hIcon is defined as:

DEF hIcon[10]:UINT

Thanks,
Andy.
Title: Re: SETICON Question
Post by: LarryMc on December 02, 2020, 12:59:40 AM
Seems like I remember that problem popping up way back but I can't remember why.
Here's the source for that sub.
$undeclare SETICON
global SETICON

DECLARE SETICON(win as WINDOW,handle as UINT)
DECLARE IMPORT,SetClassLongA(hwnd as UINT,nIndex as INT,dwNewLong as INT),INT

SUB SETICON(win as WINDOW,handle as UINT)
IF(win <> 0)
SetClassLongA(win.hwnd,-14 /*GCL_HICON*/,handle)
ENDIF
RETURN
ENDSUB
Title: Re: SETICON Question
Post by: Andy on December 02, 2020, 01:22:19 AM
Found it Larry!

http://www.ionicwind.com/forums/index.php?topic=4574.msg35749#msg35749

Before setting the icon for the second window, apparently you need to do this:

$define WM_SETICON 0x0080
$define ICON_SMALL 0
SENDMESSAGE w1, WM_SETICON, ICON_SMALL, hIcon[1]
Title: Re: SETICON Question
Post by: LarryMc on December 02, 2020, 08:47:17 AM
Well, at least my memory isn't COMPLETELY gone but it's getting close it seems.

glad you found it.