flat assembler
Message board for the users of flat assembler.

Index > Main > Way to declare ressources (newbie)

Author
Thread Post new topic Reply to topic
Traxler



Joined: 30 Oct 2014
Posts: 12
Traxler 03 Apr 2015, 02:16
Hello "world",

my programm begins like that :

include 'I:\Fasm\Include\win32ax.inc'
.code
start:

blablabla...

.end start

.data
toto dd ?

section '.rsrc' resource data readable
directory RT_ICON, icons, RT_GROUP_ICON, group_icons
resource icons, 1, LANG_NEUTRAL, icon_data
resource group_icons, IDI_FRANCE, LANG_NEUTRAL, main_icon
icon main_icon, icon_data, 'I:\Fasm\res\france.ico'

So is there a way to simplify the las 5 lines ?
Thanks for your help.
Laughing
Post 03 Apr 2015, 02:16
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 03 Apr 2015, 05:39
Traxler,

What kind of simplification do you need? Stock resource macros are direct implementation of PE internal structures related to resources. If the only resource you want is an icon, make a wrapper macro for those 5 lines.
Post 03 Apr 2015, 05:39
View user's profile Send private message Reply with quote
Traxler



Joined: 30 Oct 2014
Posts: 12
Traxler 03 Apr 2015, 09:33
what is a wrapper macro,can you give me example ?
Post 03 Apr 2015, 09:33
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 06 Apr 2015, 18:29
Traxler,

Here you go (untested):
Code:
macro app_icon id, filename {
  local icons, group_icons, icon_data, main_icon
  section '.rsrc' resource data readable
  directory RT_ICON, icons, RT_GROUP_ICON, group_icons
  resource icons, 1, LANG_NEUTRAL, icon_data
  resource group_icons, id, LANG_NEUTRAL, main_icon
  icon main_icon, icon_data, filename
}
;;; Usage:
app_icon IDI_FRANCE, 'I:\Fasm\res\france.ico'    
Post 06 Apr 2015, 18:29
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-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.