March 28, 2024, 08:20:46 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


loadresource inside a static lib

Started by LarryMc, August 17, 2007, 09:39:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

August 17, 2007, 09:39:55 PM Last Edit: August 17, 2007, 09:50:07 PM by Larry McCaughn
Still working on the same application.
I'm about to give up on being able to make my wysiwyg editor a class.

I have a lot of buttons with images that I have loaded as resources.
When the class methods are in the same source file as the calling dialog the loadresource method works great.(it's working in an exe file.)

When I separate and compile the class methods as a static lib and invoke it from my calling dialog which is now in a separate exe file the loadresource command doesn't work anymore.

FYI, in both cases the method that contains the loadresource command is called from another method in the class and not by my calling dialog.

It shouldn't be this hard to get this to work; the class file is less than 200 lines long.

Larry

Edit:
Reading about resources the term executable is used several times.  Right now I'm assuming that a static lib is not an "executable" and therefore it is normal for loadresource not to work.

If that is the case does anyone have any idea of how I can store about 40 .gifs, .htmls, and .css files in a static lib that can be gotten to at runtime?

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

ts-soft

compile the resources with gorc or an other resource-compiler to a *.res. This file can you import with $USE "myresource.res"
The static lib can use it, loadresource is a runtime command
Sorry for my bad english

Ionic Wind Support Team

A resource file is compiled binary file.  It is created by the resource compiler when you make your executable, and then linked in by the linker.  When you make a static library only your source code is compiled, not any resources.

Off the top of my head I don't remember if the binary resource file has a COFF header, which would be necessary to include it in a static lib.  Probably not since even with C if a static lib requires resources we normally drag and drop from one resource script to another before making the executable.

You could precompile the resources as ts-soft suggests, and include that with your package.  The GoRC manual is included with Emergence and is accessable from the help menu.

Paul.

Ionic Wind Support Team

LarryMc

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

ts-soft

Quote from: Larry McCaughn on August 17, 2007, 10:23:28 PM
Thanks guys
.

got any ideas on my other major problem?
http://www.ionicwind.com/forums/index.php/topic,1857.0.html

Larry

I miss the resources, but a tip for you:
Add all resources as Typ HTML
example:
about.html HTML "about.html"
ts_avatar.gif HTML "ts_avatar.gif"

load in the browsercontrol only the first page with a url like this:
"res://" + getstartpath + "myprogramm.exe/ABOUT.HTML"

greetings
Thomas

Sorry for my bad english

ts-soft

Here a short example with HTML-Resource
Sorry for my bad english

LarryMc

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

Thomas
your example "welcome.zip" works fine for pulling a html page from the .res file and passing it to the browser.

I haven't been able to figure out how to copy that file (inside the .res file) to the harddisk (which is what I need to do with other files in my .res file).

Maybe you or my man Sapero can show me how.

Larry

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

ts-soft

August 18, 2007, 07:03:07 PM #8 Last Edit: August 18, 2007, 07:06:10 PM by ts-soft
Normal it isn't required to extact any html-resource type resource, but the html should not use a path to load a script, image or anything.

For extracting use:
length = GETRESOURCELENGTH("bla.html",  23)
and LOADRESOURCE("bla.thml", 23, mymem) and write this to disc

Not tested, but this way is described in the help and should work with all resourcetypes


Sorry for my bad english

LarryMc

Duhhhhhh!
I was trying to make it 10 times harder than it was.
I already had the routine to do that.

Thanks Thomas


Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

ts-soft

Therefore I gave you the tip with HTML resource and res: //, makes that redundantly extract etc. and are simpler for your project  ;)
Sorry for my bad english