rpetruni
asked on
Resource files
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
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
ASKER
Hi Viktornet,
you think something like that?
procedure TForm1.Button1Click(Sender : TObject);
var
il: THandle;
begin
il:=LoadLibrary('NameOfMyD ll.dll');
if il<32 then
begin
ShowMessage(IntToStr(GetLa stError()) );
end;
Image1.Picture.Icon.Handle :=LoadIcon (il, PChar('3'));
Image2.PictureBitmap.Handl e:=LoadBit map(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?
you think something like that?
procedure TForm1.Button1Click(Sender
var
il: THandle;
begin
il:=LoadLibrary('NameOfMyD
if il<32 then
begin
ShowMessage(IntToStr(GetLa
end;
Image1.Picture.Icon.Handle
Image2.PictureBitmap.Handl
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?
ASKER
Ooooooooooops,
1. Nothing in image 1 (traying to load an icon),
Image2 is ok ... ???
1. Nothing in image 1 (traying to load an icon),
Image2 is ok ... ???
ASKER
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.Handl e:=LoadIco n(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
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.Handl
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
For icons, use:
...Icon.Handle := LoadIcon(il, MAKEINTRESOURCE(3));
For bitmaps, use
bmp.LoadFromResourceID(il, 3);
Cheers,
Phil.
...Icon.Handle := LoadIcon(il, MAKEINTRESOURCE(3));
For bitmaps, use
bmp.LoadFromResourceID(il,
Cheers,
Phil.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
whoops should've done a refresh <blush>
Yeah, me too. I didn't see your answer! ;-)
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. ;)
The URL Barry gave you is undoubtly a perfect answer to the question. ;)
>>I have no affiliation to the site
:o)
:o)
Just for the drama effect, like those folks that sell stuff on TV.
ASKER
Yep, the site is really good...
And the info in this zip is much more than i asked for...
Thks
And the info in this zip is much more than i asked for...
Thks
..-=ViKTOr=-..