i thought weditres was good but its not as good as i thought ;/

im sick of looking around for a good free one so i thought i'd teach myself how to write resource scripts, and then make a simple, free resource editor...i'm thinking of making it pseudo visual, meaning it wont have drag and drop buttons and controls but for each type of resource it will have a dialog box which will ask for the necessary information from you, and once u enter that it will write out the script for you

if anyone wants to help please lemme know (im still in the process of learning the win32 api, so first i'll have to get at least decent at that, which i figure will take me a month or so, and after that i'll set out on this project)

it will handle all kinds of resources...icons, dialog boxes, menus, cursors (animated or not), string tables, etc. etc.

input from the gurus will be much appreciated at this time :grin:
Posted on 2003-05-03 23:07:32 by AnotherWay83
Good luck!
Posted on 2003-05-03 23:33:21 by comrade
Welcome to Dialog Units to Pixels hell...

Posted on 2003-05-03 23:42:37 by donkey
Read this thread: http://www.asmcommunity.net/board/index.php?topic=9757
Read this code: http://asmedit.massmind.org/files/ResEdit.zip

...it would be good to see what new and creative ideas you can implement.
Posted on 2003-05-03 23:43:12 by bitRAKE
Yes, it would be nice to see some fresh ideas in that area, they all tend tolook the same. As a small tip to get you moving in the right direction:

When you make your editor create an intermediate file format that is specifically designed for you editor. Don't try to write an RC file interpretter right away, this is much more work than it looks. With an intermediate format you can quickly get to concentrating on the look and feel of your editor. Converting from that format to RC is relatively easy to do. Many editors use a dlg file that creates a dialog header and item structures, these are then converted into RC files. If I was doing one that is probably the approach I'd take. For an example of an intermediate dialog structure check out the dlg file format in the RadASM help file. Once you can go from dialog editor to intermediate to RC then you can look doing it in reverse. But be aware that parsing an RC can be difficult and is not really 100% necessary to what you are doing, it will be at most an interesting feature.
Posted on 2003-05-04 00:17:58 by donkey
thanks for all ur replies!

i just took a look at the symantec resource editor, its quite nice

luckily mine wont have to be nearly as complicated :grin:

the symantec editor includes components that let u create ur own fonts/cursors etc. but i was thinking that these days theres no point in starting all the way from scratch...theres already a number of good, free icon, cursor, font and bitmap creation tools available (a really nice free icon/cursor creation tool i found today is IconArt, look at www.conware.org)...no need to reinvent the wheel there!!!

i was thinking that my approach would be more like the resource file editor feature of the bloodshed IDE (www.bloodshed.net)...only much better so that it would support all kinds of resources...

my only goal is be to minimize the amount of typing involved in writing out the resource scripts

as for the parsing of the .rc file, i thought i just had to feed it to the resource compiler??? i have much to learn yet :grin:
Posted on 2003-05-04 00:43:09 by AnotherWay83
Yes, you'll just be feeding it to the resource compiler but you have to be ableto load and save your dialog. After all you may not want to do it all in one shot or may want to modify it later. Trying to use only the rc file as output will be a pain, an intermediate file format that is easy to convert and to load by your editor is the best way. There is no need to convert from RC to the intermediate format in this type of program structure.
Posted on 2003-05-04 00:49:15 by donkey
thanks donkey, u've given me lots to think abt :cool:
Posted on 2003-05-04 01:08:29 by AnotherWay83
Hi, I would like to help you, it's just that I ran out of time

A while ago I tried to create a resource editor myself, and I have a lot of usefull
information. It is good to hear that you like the bloodshed IDE, because I created
some examples of what my resource editor would look like, using that IDE.

I can send it to you if you wish, it's is a little bit to big to attach it
Posted on 2003-05-04 06:43:33 by Guerrilla
I've always wanted to do the same one day... it would be an excellent example of OOP programming. However, i tend to have too many project on the go (as always)... maybe one day!

If you need help, feel free to ask questions... Im full of ideas here ;)
:NaN:
Posted on 2003-05-04 12:51:38 by NaN
thanks guerrilla and nan....i've been thinking abt what donkey said, abt having the intermediate file format, and ive come up against a problem i think...it would work fine if the user was starting a resource script from scratch, because then i could store the info in my own way in the format and only convert it to .rc at the end before feeding it to the resource compiler...but what if the user wanted to open and edit an .rc file?

i want the program to be able to read the script file and tell the user 'this resource file contains definitions for...' where the ellipses are types of resources defined in the script. so if the resource script had a dialog box and a menu and an icon in it, the program would say 'this file contains definitions for a dialog box, a menu and an icon. which would you like to edit?' and then the user would pick which ones he/she would like to edit...for each one that is to be edited, the program would pop up a dialog box asking for the required info...but heres the other challenge...when editing, the dialog box that will popup for each resource to be edited should *already* contain the parameters which exist in the resource script...like the x and y coordinates, the size etc. etc....

i think that converting an .rc file to my intermediate file format everytime it was opened would be a bit of a waste...any solutions??
Posted on 2003-05-04 15:27:59 by AnotherWay83
That's the draw back to intermediate files. It is very difficult to write a parser for RC files, in effect you must write the big part of RC.EXE to have it done properly,it actually is not difficult at all to make the step to actually building the compiled RES so in effect if you want to parse the RC completely you have to rewrite RC.EXE. Believe it or not it is much easier to compile the file with RC.EXE then decompile it inside your program. That is the approach I took in the Res2Dlg addin for RadASM. I began to pseudo-code an RC parser in my head and have lived with the migrain ever since.

Your best solutionis to edit files that you have created, that means you never have to import from the RC file, just open your intermediate file. Later you can add import functions from various sources like RC files, RES files or PE files. But for now the goal is to get the idea off the ground and the best long term solution is to use intermediate files. This gives you expandability without being slaved to the RC format, for example custom controls or mutliple names for controls based on flags.

For Resource types you can always create a central resource file that contains #includes and link smaller resources whose name denotes their contents. e.g.
[b]Main RC file (MyRC.RC)[/b]

#include Resource.h
#include MyRC_Stringtable.RC
#include MyRC_Dialog1.RC
#include MyRC_Dialog2.RC

[b]MyRC_StringTable.RC file :[/b]
; This is a comment line that describes the file
#define IDS_STRING1 600
STRINGTABLE DISCARDABLE
BEGIN
IDS_STRING1 "8987987987"
END
Posted on 2003-05-04 15:50:09 by donkey
yes i'm afraid parsing is gonna be a big headache, thats why i have a plan :grin:

i worked with perl a couple yrs. ago and it has these incredibly powerful regular expressions...for parsing text theres just no beating it

so i was thinking if there was a way to convert a perl script written specifically to parse the RC into an exe which could then be called by my prog...wouldn't that make things alot better???

just thinking, i have to research this idea a bit more...if that doesnt pan out then i'll take the intermediate file format route...thanks alot for your help donkey!!!

EDIT: turns out theres a prog that does just what i want, its called perl2exe!!! guess im in luck =)
Posted on 2003-05-04 16:20:29 by AnotherWay83
Bah PERL, you lost me :)

Good luck with the project, I've said my bit.
Posted on 2003-05-04 17:05:56 by donkey
Parsers are truely the hardest part of such projects... its the reason the our MASM OOP generator never got to the next level. Thomas did alot of design work in this area, but time just wasnt on our side here (more my fault ;) )

Im currious about your perl solution. Im practically illiterate when it come to perl. I've seen its source before tho (had a die hard linux friend who loved it ~ was always showing me the next 'coolest' thing hez done with it), but i cant say i understand it.

How would a windows exe program interface with this script in a controlled fashion? How would you populate heap memory in the win exe so that you can manipulate it? Its easy to output data, but getting it in so you can do something is something entirely different.... If its as easy as it sounds, it would be an amazing asset for *alot* of appications.

:NaN:
Posted on 2003-05-04 20:54:28 by NaN
For me anyway, I thought about writing a simple dialog.rc parser and it was insane. There are so many ways to build an RC file, I stopped dead at the flags. You need to get all of the windows.inc flags in text format to decode it (ES_AUTOHSCROLL | ES_LEFT |WS_TABSTOP) but the flags can also be in hex (0x50010000) logical hex (NOT 0x00820000|0x50010000) or whatever hex (there was one I saw once I didn't understand). And the types of controls are endless LTEXT,RTEXT,CTEXT are all Static controls, and the keyword CONTROL can mean any type of control.

It was just way too much work for a simple import task. In the end I just required that it was compiled then wrote a decompiler. I suppose I could have shelled to rc.exe and compiled it in-program though to a tempfile then decompiled that, would have been a solution to supporting RC files. Makes me respect RC.EXE alot more now though. Hopefully it can be done more easily in PERL than in ASM otherwise you have alot of work ahead of you.

My simple decompiler will do string tables and all dialog types, I am currently adding menus. Soon it will be 3000 lines of asm code and it only does 5 resource types. Granted that the rest are easy, most like bitmaps have a header footer and binary data.

If you want to take a look at my decompiler it is available in the IDE forum here , it is a dll project for RadASM but there are many useful routines. Feel free to use anything you want (give me a little credit somewhere though)
Posted on 2003-05-04 21:20:15 by donkey
nan,

regexes (short for regular expressions) are extremely powerful...i once wrote a comand line calculator in perl that was powerful enuff to give the correct answer to even expressions like this:

3+( ( (++++2*5/4/3.4/(4^2.3) ) + -7^1^--+2^((3))^(2/3) + (((3)4)5)^3 +----+++56 + 3 +++4--6 ) )


it would properly convert things like ---++++ to a single sign (in this case, -), get rid of extraneous brackets so (((3+4))) would become (3+4)

imagine doing that in assembly :grin:

and it was also quite fast, and it could do it with just 5-7 regexes!!

thats the reason why perl was the first thing that came to mind...it could be really useful for alot of things like say determining how many BEGIN-END pairs there were and so on

the program that i mentioned (perl2exe) is freeware and it creates a standalone .exe out of the perl script so that the user doesnt have to have the interpreter installed on their system in order to run it...so i mite either be able to link it to my exe or call it separately, which isn't so bad either


donkey,

thanks for the offer, i will look into it and let u know if any of it comes in handy
Posted on 2003-05-04 22:14:11 by AnotherWay83
I look forward to seeing any progress you make... thanx!

:alright:
NaN
Posted on 2003-05-04 23:34:03 by NaN
thanks, i'll begin work on the project in a month or 2
Posted on 2003-05-05 01:02:12 by AnotherWay83
I would like to be with you !
that will be a cool project !
Posted on 2003-05-05 13:21:13 by Bubu-Boy