Question

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;
Was it helpful?

Solution

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));

OTHER TIPS

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.

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); 

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top