tags:

views:

296

answers:

4

I am trying to extract a gif image embedded as a resource within my ISAPI dll using WebBroker technology. The resource has been added to the DLL using the following RC code:

LOGO_GIF RCDATA logo.gif

Using resource explorer I verified it is in the DLL properly.

using the following code always throws an exception, "resource not found" (using Delphi 2009)

var
  rc : tResourceStream;
begin
  rc := tResourceStream.Create(hInstance,'LOGO_GIF','RCDATA');
end;
+1  A: 

If I remember correctly you are actually dealing with an instance of the web server, not the dll. I don't remember the work around though, but that is the explanation for why that doesn't work. Hopefully someone else can build off of this.

Jim McKeeth
+2  A: 

RCDATA is a pre-defined resource type with an integer ID of RT_RCDATA (declared in Types unit).

Try accessing it this way:

rc := tResourceStream.Create(hInstance,'LOGO_GIF', MakeIntResource(RT_RCDATA));
Tim Knipe
you don't need the MakeIntResource at all
Jeroen Pluimers
+1  A: 

Either use your own arbitrary resource type like GIF:

LOGO_GIF GIF logo.gif

then use

rc := tResourceStream.Create(hInstance,'LOGO_GIF','GIF');

or simply use

rc := tResourceStream.Create(hInstance,'LOGO_GIF', RT_RCDATA);
François
+1  A: 

or simply use

rc := tResourceStream.Create(hInstance,'LOGO_GIF', RT__RCDATA);

This. Works like a charm.

D2009 here, too, had the same issue, but was trying to get TStringsList out of the DLL.

Thanks.