March 28, 2024, 02:43:39 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


SETICON Question

Started by Andy, December 01, 2020, 11:48:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

December 01, 2020, 11:48:54 PM Last Edit: December 01, 2020, 11:51:00 PM by Andy
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.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

December 02, 2020, 01:22:19 AM #2 Last Edit: December 02, 2020, 01:24:06 AM by Andy
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]
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

Well, at least my memory isn't COMPLETELY gone but it's getting close it seems.

glad you found it.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library