Loading bitmap from DLL (stored in Resource)

  Even tho this is a graphics question, it's also an API question (just in
case...)

  How do you load a bitmap from a DLL?  --  I've tried (so far) exporting a
'TBitmap' and an 'hBitmap'  --  TBitmap crashed, but hBitmap returned a
valid handle (unfortunately, it didn't include the picture...)     :P

  Here's an example of my code:

---
library BMP_RES;
uses windows, Graphics;

{$r flags.res}

function GetBMP(aRes: PChar): hBitmap; export;
var
  aBMP: TBitmap;
begin
  with aBMP do begin
    aBMP := TBitmap.Create;
    LoadFromResourceName(HInstance, aRes);
    Result := aBMP.Handle;
    Free;
  end;
end;

exports GetBMP;

begin
end.

---
  The code in my program:
---
procedure TfmForces.drawImages;
type
  TGetBMP = function(aRes: PChar): hBitmap;
var
  BMP: TBitmap;
  GetBMP: TGetBMP;
  hLib: THandle;
begin
  with BMP do begin
    BMP := TBitmap.Create;
    hLib := LoadLibrary('BMP_RES.DLL');
    @GetBMP := GetProcAddress(hlib, 'GetBMP');
    Handle := GetBMP('US');
    Transparent := True;
    TransParentColor := clFuchsia;
    TransparentMode := tmFixed;
    fmForces.Canvas.Draw(491, 40, BMP);
    BMP.Free;
  end;
end;

  As I said, this returned a valid handle, just not the bitmap itself...  --
Is this even possible....

  OR, is there a way to load from a resource, but NOT to compile it in the
exe (ie. load the Resource File at run-time...  (something I just thought
about, I'll start playing with that now...))

  Please forward any responses via. E-mail....

--
Jason Wallace
SL Software
Dark...@SLSoftware.reno.nv.us
--
"We are Microsoft.  Resistance is Futile.   You will be Assimilated."
--