Link to home
Start Free TrialLog in
Avatar of degraef
degraef

asked on

reading bmp file from dll

When trying to load a picture (800x600.bmp) into an Image field, from a dll.

var
hLib : integer;
hRes : Thandle;
begin
hLib:=loadLibrary('e:\unpack\1\empire.dll');
hREs := findREsource(hLib,'black','800x600');
Image1.Picture.LoadFromFile(string(hRes));
end;

this gives me an error message saying picture with invalid extension. However I think it is something else.
I made a simple dll, with a res file called black.res.
Avatar of ZifNab
ZifNab

Try this (haven't tested it! Just a guess!) :

 
    DllHandle := LoadLibrary({name.dll});

    And use this DllHandle with
   
    Image1.Picture.LoadImage(DllHandle, 'black', image_bitmap,
                             800,600, (options);


  Have fun,
  c.u.
  ZifNab;
Is this a Dll you wrote? or someone else?
ASKER CERTIFIED SOLUTION
Avatar of Waldek
Waldek

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
????

{name.dll} is dll file you want to read.

In your case it's LoadLibrary('e:\unpack\1\empire.dll');

and LoadImage is just a function of Win32. (New - Windows95)
Avatar of degraef

ASKER

nothing suggested here seems to work.
Here is the complete history.

created res file as follows;  black.res 'black' '800x600.bmp'
put it in a dll ($R black.res) compiled the dll = empire.dll.

in mainform of program I have an Image1 component.

The Load.Image1.Picture
or Image1.Picture.LoadImage suggested did not work.
What are the errors?
Did you make your Res -file with the image editor of delphi?
Avatar of degraef

ASKER

With Load.Image1.. I get 'Unknown command' as well as the LoadImage

I made the res with brcc32.exe
Which version of Delphi are you working on?
What if you make the res with Image editor?
Avatar of degraef

ASKER

Delphi 3

Haven't tried the image editor yet