The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => The Orphanage => Topic started by: xanatose on January 30, 2009, 02:38:50 AM

Title: [Question] Loading resources from a .res file?
Post by: xanatose on January 30, 2009, 02:38:50 AM
Is there any example of doing this? I want to share resources (dialogs, icons, etc.) between 2 versions of the same application (32bit and 64 bit).


Title: Re: [Question] Loading resources from a .res file?
Post by: Tedd on January 30, 2009, 10:50:22 PM
You could try linking the resources into a DLL, and then each program uses that DLL.
Title: Re: [Question] Loading resources from a .res file?
Post by: Vortex on January 31, 2009, 05:22:17 PM
You can do that with assemblers supporting the INCBIN statement reading data from files.
Title: Re: [Question] Loading resources from a .res file?
Post by: Vortex on February 03, 2009, 09:07:39 PM
Here is a Jwasm example loading resources from .res files :

EMPTY_RSRC_SECT equ 32
RSRC_ENTRY      equ 32
RSRC_OFFSET     equ EMPTY_RSRC_SECT+RSRC_ENTRY

.data

Dlgbox  LABEL byte
INCBIN  "Dlgbox.res",RSRC_OFFSET

Menu    LABEL byte
INCBIN  "Menu.res",RSRC_OFFSET

[attachment deleted by admin]
Title: Re: [Question] Loading resources from a .res file?
Post by: xanatose on February 09, 2009, 04:16:17 PM
Thanks
Title: Re: [Question] Loading resources from a .res file?
Post by: xandaz on December 04, 2010, 03:54:53 PM
    Hi there. How the hell does one use the resources. I made this dialiog and an .rc files came out. The dialog has identifier 1000 but when i call DialogBoxParam nothing appears. Shouldn't i hace also a .res file? The files just need to have rsrc name and get into the executable when its built right? Thanks
Title: Re: [Question] Loading resources from a .res file?
Post by: Vortex on December 04, 2010, 05:20:25 PM
Hi xandaz,

Did you compile your .rc file? The resource compiler rc.exe outputs a .res file :

\masm32\bin\rc.exe rsrc.rc
Title: Re: [Question] Loading resources from a .res file?
Post by: ramguru on December 04, 2010, 05:57:35 PM
Quote from: Tedd on January 30, 2009, 10:50:22 PM
You could try linking the resources into a DLL, and then each program uses that DLL.

It could be tricky unless you know how to load 32bit dll from 64bit application :}
Otherwise you'll have to use 32bit and 64bit dll respectively

Quote from: Vortex on January 31, 2009, 05:22:17 PM
You can do that with assemblers supporting the INCBIN statement reading data from files.
INCBIN stores binary data in application, so that wouldn't be sharing (the only advantage - direct pointer to the data)  :naughty: , in regard to size it's the same as using resources as you would normaly in .rsrc section of each 32/64 app
Title: Re: [Question] Loading resources from a .res file?
Post by: jj2007 on December 04, 2010, 06:14:05 PM
Quote from: ramguru on December 04, 2010, 05:57:35 PM
You could try linking the resources into a DLL, and then each program uses that DLL.

There is no CallProc64D (http://support.microsoft.com/kb/104009), apparently ;-)
Title: Re: [Question] Loading resources from a .res file?
Post by: xandaz on December 05, 2010, 09:16:54 AM
    Thanks Vortex. I got it. It was just something i had never done. thanks and bye