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

  • Home
  • SEARCH
  • 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 7659799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:22:49+00:00 2026-05-31T13:22:49+00:00

In Delphi, I’m building an HTTP Application, or a Web Server rather. It’s essentially

  • 0

In Delphi, I’m building an HTTP Application, or a Web Server rather. It’s essentially an entire website built into a single EXE file. The files I’m embedding include HTML, JS, CSS, SWF, PNG, XML, etc. The resource names are the same as the original filename, with the . replaced with an _. In the end, there will be somewhere around 40-60 files embedded inside the EXE.

The problem is I don’t want to write code wrapping each and every individual file. Right now, I am declaring a constant for each resource, and using that constant when acquiring the resource using TResourceStream. The HTTP request is asking for any particular file, and since I’ll have a bunch of files, I don’t want a separate way of handling each file. Plus, in the future, when I add a new file to be embedded, all I should have to do is add it to my Resource Script (.rc). So I decided to change my mechanism to automatically resolve the filename requested to the name of the resource. For example, /Home.HTML gets resolved to HOME_HTML which is supposed to be the name of the embedded resource. I need to check if such a resource exists before loading it.

I could try to load it and catch any exception but this would produce errors in debug if the resource doesn’t exist. How would I go about performing such a check without using try..except?

  • 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-31T13:22:50+00:00Added an answer on May 31, 2026 at 1:22 pm

    You can use the FindResource API, something like

    if(FindResource(hInstance, PChar(ResourceName), RT_RCDATA) <> 0)then begin
       // load the resource
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Delphi developers has several tools (several alternatives to ASP.NET) for building web applications. While
Delphi strings use single quotes, for example ' a valid string '. How does
Delphi 2010, Win32 VCL. I need to create a main menu for my application
Delphi 7 SQLSERVER 2000 I am having a problem with a legacy application that
Delphi does not yet support building 64-bit applications. What common tools are there for
our delphi application can have multiple DirectX windows, often on multiple screens. up to
Delphi used to include a demos folder for web Services, but no longer seems
Delphi XE2, so I guess that is Indy 10(?). One server, 10 clients. I
Delphi 2009 has changed its string type to use 2 bytes to represent a
Delphi (and probably a lot of other languages) has class helpers. These provide a

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.