October 29, 2025, 01:09:26 PM

News:

IWBasic runs in Windows 11!


SETICON Question

Started by Andy, November 29, 2014, 04:55:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

Hi,

Now that I've moved onto building projects rather than just single file programs I came across something...

I could not select an icon for the project .exe file, when you compile a single file source there is an option for that, so I decided to use the SETICON function instead for the project.

Now this is what the help file says....

"SETICON(win as WINDOW,handle as UINT)

Description

Sets the icon for the window or dialog.

Parameters

win - Window or dialog.

handle - Handle of new icon returned by the LOADIMAGE function."

I missed using the SETICON command for one of the screens, but never the less the icon was still there for that screen - but can anyone tell me why this should be?

Not complaining because that's how I want it anyway, it's just a puzzle to me.

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

what you really want to do is add the icon you want to use to the resource file and give it an ID of I
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

Confused as always!

The Resource Compiler help puts an ICON resource type number at 3, which works for me (24 bit)

In my latest program, I have a 64x64 icon at 3, and a 16x16 icon at 101, which puts a small icon on the titlebar (256 shades)

I know you should have a lot more sizes and bit depths, but 64x64 works at most view sizes, without bloating the program's size

Brian

Andy

Yes,

I'm doing what you and Brian suggest,

I've added it as an Icon resource - ID 27 (that's my last resource)
and the in the main program I load the image:

hIcon = LOADIMAGE(27,@IMGICON)

Then I can use:
SETICON win,hIcon (win is the window).

Thanks,
Andy.


Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Brian

Andy,

As I said, if you add as a Resource, a suitable size icon at ID 3, and a 16x16 icon at ID 101,
you don't need to use LOADIMAGE or SETICON at all, they are just where they should be
when you compile your program

Brian

AdrianFox

Thanks for that information Brian.  That is entirely new to me and obviates all the other steps I usually need to take. 
Adrian Fox