Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7631583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:23:29+00:00 2026-05-31T06:23:29+00:00

I followed a tutorial here for how to include a file inside of an

  • 0

I followed a tutorial here for how to include a file inside of an EXE. While I successfully got a PNG image compiled, when it comes to using it, I’m unsuccessful.

MyResources.rc

LOGO_PNG RCDATA Resources\Logo.png

MyConsoleUnit.pas

const
  RES_LOGO_PNG = 'LOGO_PNG';

implementation

{$R *.dfm}
{$R 'MyResources.res' 'MyResources.rc'}

Now this is where things get a little confusing for me. I have to work with all streams, no files. I have embedded this PNG image Logo.png as this resource to be passed back as content (as a stream) when /Logo.png is requested from the web server. I also followed a very basic tutorial for this:

procedure TMyWebConsole.MyWebConsoleLogoAction(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
  RS: TResourceStream;
begin
  RS := TResourceStream.Create(HInstance, RES_LOGO_PNG, RT_RCDATA);
  try
    Response.ContentType:= 'image/png';
    RS.SaveToStream(Response.ContentStream);
  finally
    RS.Free;
  end;
end;

The problem is, when this function is called (at SaveToStream) I get an access violation. The web browser on the client end receives the same error message as the content of the “PNG file”.

AV

So why is it doing this? What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:23:30+00:00Added an answer on May 31, 2026 at 6:23 am

    You’re accessing a null pointer. It’s probably Response.ContentStream, which is a property you’re supposed to assign, not read. The documentation says this:

    Note: If the value of the ContentStream property is not nil, the Content property is ignored.

    That suggests the ContentStream might be nil. Thus, you need to assign a value to it if you want to use it:

    Response.ContentStream := TResourceStream.Create(HInstance, RES_LOGO_PNG, RT_RCDATA);
    

    The documentation further explains:

    If you use the ContentStream property, do not free the stream yourself. The Web response object automatically frees it for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've followed the tutorial here: http://book.cakephp.org/view/1286/Sending-a-basic-message , which I have successfully used before with
I have followed the tutorial posted here in order to get AJAX file uploads
I followed this tutorial here: http://www.dannyherran.com/2011/02/facebook-php-sdk-and-codeigniter-for-basic-user-authentication/ It works great but when I enable CSRF
I have followed this tutorial here as mentioned exactly I now try to run
I followed the tutorial found here and added my own flare to it: tutorial
So here's my issue: I followed the NSURLConnection tutorial in the iPhone Developer Documentation
I followed this tutorial: https://github.com/EllisLab/CodeIgniter/wiki/PDF-generation-using-dompdf However, I can't seem to set the path right.
I followed this tutorial and got the basics of Content Providers : http://www.vogella.de/articles/AndroidSQLite/article.html But
Beginner here to hibernate, spring. Followed tutorial here to setup hibernae + spring +
I followed the tutorial here but when I create the project in Eclipse, i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.