flat assembler
Message board for the users of flat assembler.

Index > Windows > directly use a group icon?

Author
Thread Post new topic Reply to topic
yoshimitsu



Joined: 07 Jul 2011
Posts: 96
yoshimitsu 07 Aug 2011, 08:00
hi there,
just wanted to ask wether it's possible to directly use a group icon.
i don't quite get the format of icons but with masm's linker it's for example possible to specify an icon which contains a 32x32 and a 48x48 version.
but as fasm's icon-macro reads out an icon it just gets the first one embedded, so it's not possible to directly insert an icon group, is it?
thanks
Post 07 Aug 2011, 08:00
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 07 Aug 2011, 08:52
No, it is not possible. Actually the easiest way to make it is to use .res file, created with some resource editor/compiler and then to create directly the resource section with:
Code:
section '.res' resource readable from 'yourresources.res'    


I prefer to use ResHacker.
Post 07 Aug 2011, 08:52
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
yoshimitsu



Joined: 07 Jul 2011
Posts: 96
yoshimitsu 07 Aug 2011, 11:01
but then it wouldn't be possible to use fasm's resource-facilities in combination because of the resource directory with which the resource data starts, would it?
Post 07 Aug 2011, 11:01
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 07 Aug 2011, 11:07
Yes, in this case you have to compose all needed resources in the .res file.
Post 07 Aug 2011, 11:07
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8349
Location: Kraków, Poland
Tomasz Grysztar 10 Aug 2011, 14:17
Yes, the macro currently is not able to load multiple icons from one .ico file, but you can still create the icon group by using multiple .ico files.

documentation wrote:
The are two resource types related to icons, the RT_GROUP_ICON is the type for the resource, which has to be linked to one or more resources of RT_ICON type, each one containing single image. This allows to declare images of different sizes and color depths under the common resource identifier. This identifier, given to the resource of RT_GROUP_ICON type may be then passed to the LoadIcon function, and it will choose the image of suitable dimensions from the group. To define the icon, use the icon macroinstruction, with first parameter being the label of RT_GROUP_ICON resource, followed by the pairs of parameters declaring the images. First parameter in each pair should be the label of RT_ICON resource, and the second one the quoted string containing the path to the icon file.

Source: Resource macros documentation

And I think the macro could be easily extended to allow index of icon in file after the file name (like 'my.ico':0 in place of current 'my.ico'), but there is no such feature implemented there for now.
Post 10 Aug 2011, 14:17
View user's profile Send private message Visit poster's website Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 10 Aug 2011, 17:32
This macro came from somewhere on this forum.
I dont know where from or who the author was?
Code:
macro multi_icon group,[label,icon_file,num]
{  common local count
    count = 0 
   forward local data,size,position 
    label dd RVA data,size,0,0 
    virtual at 0 
     file icon_file:6+(num*16),16 
     load size dword from 8 
     load position dword from 12 
    end virtual 
    data file icon_file:position,size 
    count = count+1 
   common local header 
    align 4 
    group dd RVA header,6+count*14,0,0 
    header dw 0,1,count 
   forward 
    file icon_file:6+(num*16),12 
    dw label#.resid 
   common 
    align 4
}

directory RT_ICON,dir_icons,\
          RT_GROUP_ICON,dir_group_icons

resource dir_icons,\
  1,LANG_NEUTRAL,icon_data1,\
  2,LANG_NEUTRAL,icon_data2

resource dir_group_icons,\
  IDR_MAINICON,LANG_NEUTRAL,res_icon_main

multi_icon res_icon_main,\
  icon_data1,'MYICON.ICO',0,\
  icon_data2,'MYICON.ICO',1
    
Post 10 Aug 2011, 17:32
View user's profile Send private message Reply with quote
Alphonso



Joined: 16 Jan 2007
Posts: 295
Alphonso 10 Aug 2011, 18:19
bitshifter wrote:
This macro came from somewhere on this forum.
I dont know where from or who the author was?


http://board.flatassembler.net/topic.php?t=6817
Post 10 Aug 2011, 18:19
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.