Question on resource file with icon.

This is main.h
#define ID_ABOUTICON 100
#define IDC_STATIC 101

The icon is 32x32.

This is rsrc.rc
100 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "images/cmc.ico"

IDD_ABOUTBOX DIALOGEX 0, 0, 135, 62
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTER
CAPTION "About FileManager"
FONT 10, " "

BEGIN
ICON ID_ABOUTICON, IDC_STATIC, 6,22, 0, 0,SS_ICON
GROUPBOX "", IDC_STATIC, 4, 3,127,54
LTEXT "FileManager, Version 1.0",IDC_STATIC,32,16, 90, 8,SS_NOPREFIX
LTEXT "Copyright (c) cmc 2019", IDC_STATIC,32,28, 90, 8
DEFPUSHBUTTON "OK",IDOK, 98,43, 20,10,WS_GROUP
END

Everything functions well, but why it isn't necessary/possible to define width and height of the icon ?

IDC_STATIC 6,22,0,0,SS_ICON
or
IDC_STATIC 6,22,some value,some value,SS_ICON

shows the ico with the same size.

Something wrong ?

Hello, clamicun.

You see when one shall design a .ico file, numerous layers must be made so the most suitable can be selected by default based on where they are used (Desktop, file explorer etc)
http://skyboygames.com/easily-create-a-windows-app-icon-with-gimp/

Perhaps in your icon, the system has chosen the most suitable layer from the sets and sets of sizes in your graphic, in other words. You don't set the dimensions, the system does appropriately
Vilch,
yes , thanks.
" the system does appropriately "

ok. But if I do not fill out width an height, I get an error.
And the x and y position does work.
So there is no problem, it works but it is strange. Not filling in parameters, ""functions"" usaually do not like
Coding does this, in my framework I must always finish of an action sequence with nullptr or NULL or We must accept these little additional elements of programs and move on. Otherwise, is your icon's size and shape fine when it is actually used as an icon?
 
auto Action = Sequence::create(action, action->reverse(), nullptr);

Last edited on
Yes, the icon looks perfect
The documentation for SS_ICON says:

The style ignores the CreateWindow parameters nWidth and nHeight; the control automatically sizes itself to accommodate the icon. As it uses the LoadIcon function, the SS_ICON style can load only icons of dimensions SM_CXICON and SM_CYICON. This restriction can be bypassed by using the SS_REALSIZEIMAGE style in addition to SS_ICON.

https://docs.microsoft.com/en-us/windows/desktop/controls/static-control-styles
dutch,
thanks a lot. That explains it.
Tried SS_REALSIZEIMAGE.
Does the job.
Thanks again.
Topic archived. No new replies allowed.