The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: andre on September 27, 2009, 03:17:34 PM

Title: who knows how to create a resource file
Post by: andre on September 27, 2009, 03:17:34 PM
a rc compiler reports an error "can't  read a resource file"
Title: Re: who knows how to create a resource file
Post by: BlackVortex on September 27, 2009, 03:26:58 PM
How do you assemble and link ?  Because normally you don't need to have a resource section/file
Title: Re: who knows how to create a resource file
Post by: andre on September 27, 2009, 03:33:19 PM
 i suppose that the programme doesn't start because there is no an icon in the programme's folder. But i think that there is no need to place an icon in the folder if is a standard one
Title: Re: who knows how to create a resource file
Post by: BlackVortex on September 27, 2009, 03:41:55 PM
What exactly are you trying to do ? You don't make much sense (at least to me)
Title: Re: who knows how to create a resource file
Post by: andre on September 27, 2009, 03:48:13 PM
i am trying to create a window. but the programme doesn't start because it can't read from resource file. i suppose it needs an icon itself in the programme's folder. but if the icon is a standard one so it must take an icon from the windows file
Title: Re: who knows how to create a resource file
Post by: BlackVortex on September 27, 2009, 03:56:06 PM
What is you program ? How are you linking ? I mean, with which commands ?
Title: Re: who knows how to create a resource file
Post by: andre on September 27, 2009, 04:00:07 PM
i use masm32 v10  there everything goes automatically
Title: Re: who knows how to create a resource file
Post by: MichaelW on September 27, 2009, 04:04:21 PM
If you are working in Quick Editor, the resource file should be named rsrc.rc.
Title: Re: who knows how to create a resource file
Post by: BlackVortex on September 27, 2009, 04:08:34 PM
Are you using Qeditor ? Are you using Build All ? Make sure there is no rsrc.rc file in the same folder (if you don't need it)

Title: Re: who knows how to create a resource file
Post by: andre on September 27, 2009, 04:20:35 PM
i downloaded masm32 from masm32.com   there separate point in menu "compile resource file"
Title: Re: who knows how to create a resource file
Post by: MichaelW on September 27, 2009, 04:30:09 PM
For the Compile Resource File command to work, there must be a .ASM file loaded into QE, and there must be a resource definition file named rsrc.rc in the current directory.
Title: Re: who knows how to create a resource file
Post by: andre on September 27, 2009, 04:31:48 PM
and how to create this rcrs file?
Title: Re: who knows how to create a resource file
Post by: BlackVortex on September 27, 2009, 04:33:13 PM
You don't need to compile a resource file unless you know're gonna use it.

If you want to create a new executable is assembly all you need to do is assemble and link it !!  :toothy
Title: Re: who knows how to create a resource file
Post by: andre on September 27, 2009, 04:37:40 PM
but how about an icon?  it needs a rc file !   
Title: Re: who knows how to create a resource file
Post by: BlackVortex on September 27, 2009, 04:39:11 PM
OK, create a rsrc.rc file and paste this in it :

#include "C:\masm32\include\resource.h"

IDR_ICON ICON DISCARDABLE "nameofyouricon.ico"


Change the name to your icon's name. And the folder to your include folder.
Title: Re: who knows how to create a resource file
Post by: andre on September 27, 2009, 04:43:23 PM
i want to use a standard icon
Title: Re: who knows how to create a resource file
Post by: BlackVortex on September 27, 2009, 04:44:47 PM
Quote from: andre on September 27, 2009, 04:43:23 PM
i want to use a standard icon
You mean as the executable icon to be shown in windows explorer ?  I don't think it's possible, you'll have to rip one from another file to use it.
Title: Re: who knows how to create a resource file
Post by: andre on September 27, 2009, 04:47:55 PM
i think there must be an icon by default which appear in the window
Title: Re: who knows how to create a resource file
Post by: dedndave on September 27, 2009, 04:58:01 PM
it can be done, but there are drawbacks
for one thing, there is no guarantee that an icon under one OS will have the same ordinal under a different OS (although they will likely match)
also, the explorer.exe file has a number of good icons - same dealeo - no guarantees
Tedd gave us a link that gives you some standard menu icons - use one from there

http://msdn.microsoft.com/en-us/library/bb760433%28VS.85%29.aspx

if you use no icon at all, it will be the default exe icon
if you still want to know how to snag the shell32.dll icons, use the forum search window and look for "shell32.dll icon"
there have been a couple recent related threads
a while back, Erol (Vortex) even showed us how to set the console mode window icon - lol
Title: Re: who knows how to create a resource file
Post by: andre on September 27, 2009, 05:04:51 PM
in examples which were included in masm package there are default icon is included in the programme example folder! i wonder why?
Title: Re: who knows how to create a resource file
Post by: ThexDarksider on September 27, 2009, 11:05:18 PM
Quote from: andre on September 27, 2009, 05:04:51 PM
in examples which were included in masm package there are default icon is included in the programme example folder! i wonder why?

Uh because there's no point in deleting a 5 kb file when it was there in the first place?

Also a bit off topic: I use IcoFX to rip icons out of .exes and .dlls.

Quote from: dedndave on September 27, 2009, 04:58:01 PMTedd gave us a link that gives you some standard menu icons - use one from there

http://msdn.microsoft.com/en-us/library/bb760433%28VS.85%29.aspx

Aw lol too bad I didn't know that, in a program I made, I ripped and saved all those icons to .ico files and then imported them into my C# project. :\
Title: Re: who knows how to create a resource file
Post by: sinsi on October 02, 2009, 01:56:35 PM
(why move it now hutch?)

Since you are creating a window and want a default icon, look to RegisterClassEx, specifically the WNDCLASSEX structure...
Quote
hIcon
Handle to the class icon. This member must be a handle to an icon resource. If this member is NULL, the system provides a default icon.
You don't need an icon for you program, windows will give you one.