Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Resource files

Posted on 1999-07-26
13
Medium Priority
?
235 Views
Last Modified: 2012-05-04
Hi all,

i know how to make dll, and how to use functions and procedures in it, but i want to make dll ONLY with resources (like bitmaps, icons, waw's  etc.).
I know how to make dll, but i don't know how to USE those resources in it..
Please help
0
Comment
Question by:rpetruni
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
  • +2
13 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1391295
You simply need to load it just the way you do, and pass the handle LoadLibrary() to the LoadBitmap() for example which would load the bitmap from the DLL...

..-=ViKTOr=-..
0
 
LVL 1

Author Comment

by:rpetruni
ID: 1391296
Hi Viktornet,

you think something like that?

procedure TForm1.Button1Click(Sender: TObject);
var
   il: THandle;
begin
     il:=LoadLibrary('NameOfMyDll.dll');
     if il<32 then
     begin
           ShowMessage(IntToStr(GetLastError()));
     end;
     Image1.Picture.Icon.Handle:=LoadIcon(il, PChar('3'));
     Image2.PictureBitmap.Handle:=LoadBitmap(il, PChar('5'));
     FreeLibrary(il);
end;

What i get with this code is:
1. Nothing in those Images :o)
2. Error message when i close an application "Invalid handle to the pointer" ???
Any idea?


0
 
LVL 1

Author Comment

by:rpetruni
ID: 1391297
Ooooooooooops,

1. Nothing in image 1 (traying to load an icon),
Image2 is ok ... ???

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:rpetruni
ID: 1391298
Ok, i foud out something more...

I cut and paste the above code to a new project and tehre is no more error ......

So my Q is ...

How to load an icon -  Image1.Picture.Icon.Handle:=LoadIcon(il, PChar('3'));
does NOT work - or am i missing something?

How to load WAW or similar files?
I will increase the points if sombody has a really good answer (like two or three lines of code ;o)
                                                                        Robert
0
 
LVL 3

Expert Comment

by:philipleighs
ID: 1391299
For icons, use:

...Icon.Handle := LoadIcon(il, MAKEINTRESOURCE(3));

For bitmaps, use

bmp.LoadFromResourceID(il, 3);

Cheers,
Phil.


0
 
LVL 17

Accepted Solution

by:
inthe earned 280 total points
ID: 1391300
hi,
i think you need to download this:
http://www.bhnet.com.br/~simonet/archive/resonlydll.zip

it is full example of using a resource only dll with various stuff in the dll.

Regards Barry
0
 
LVL 3

Expert Comment

by:philipleighs
ID: 1391301
For waves and the like, do something like this:

var hRes: HRSRC;
    gobj: HGLOBAL;
    p: Pointer;
begin
  hRes := FindResource(il, MAKEINTRESOURCE(3), RT_RCDATA);
  gobj := LoadResource(il, hRes);
  p := LockResource(gobj);
  //p is a pointer to your resource data

  ...

Cheers,
Phil.
 
0
 
LVL 17

Expert Comment

by:inthe
ID: 1391302
whoops should've done a refresh <blush>
0
 
LVL 3

Expert Comment

by:philipleighs
ID: 1391303
Yeah, me too. I didn't see your answer! ;-)
0
 
LVL 15

Expert Comment

by:simonet
ID: 1391304
Barry's got the correct answer. The site he pointed is actually the best resource on the net about resources (forgive the pun!). I have no affiliation to the site he pointed you to, but I just happen to know the guy to created that site (he's a nice fellow, by the way).
The URL Barry gave you is undoubtly a perfect answer to the question. ;)
0
 
LVL 17

Expert Comment

by:inthe
ID: 1391305
>>I have no affiliation to the site  

           :o)
0
 
LVL 15

Expert Comment

by:simonet
ID: 1391306
Just for the drama effect, like those folks that sell stuff on TV.
0
 
LVL 1

Author Comment

by:rpetruni
ID: 1391307
Yep, the site is really good...
And the info in this zip is much more than i asked for...
Thks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question