?
Solved

Resource files

Posted on 1999-07-26
13
Medium Priority
?
241 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
  • 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
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
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

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Get the source code for a fully functional Access application shell with several popular security features that Access VBA application developers desire, but find difficult or impossible to figure out how to code. You get the source code for managi…
Suggested Courses

588 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