473,395 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Holding a file as a resource in a C++ .exe

Hi,

Many apologies if this is the wrong group; if anyone can suggest a better
one please do.

I need to write a very small C++ (Win32, not .NET) application that will
essentially do a file copy after running some code to decide where to copy
the file to. Ideally I'd like to contain the file inside the EXE so that
from the user's point of view they download one file and it does what it's
supposed to do. I could equally do the same with a zip file containing the
file and a batch file to do the copy.

I can't find any information about whether it's possible to include a file
as a resource, and be able to treat it as a file from within the
application. Has anyone got any ideas?

Thanks,

Steve
Nov 17 '05 #1
4 1217
>I can't find any information about whether it's possible to include a file
as a resource
It is possible Steve, see "User-Defined Resource" in MSDN.
and be able to treat it as a file from within the
application.


You'll need to treat it as a stream of data.

Dave
Nov 17 '05 #2
"David Lowndes" <da****@example.invalid> wrote in message
news:4s********************************@4ax.com...
I can't find any information about whether it's possible to include a
file
as a resource


It is possible Steve, see "User-Defined Resource" in MSDN.
and be able to treat it as a file from within the
application.


You'll need to treat it as a stream of data.


Hi David,

OK, thanks, I'll check that out.

Steve
Nov 17 '05 #3
DL> It is possible Steve, see "User-Defined Resource" in MSDN.
and be able to treat it as a file from within the application.

DL> You'll need to treat it as a stream of data.

You could make use of the following functions to extract it at runtime:

FindResource
LoadResource
LockResource
SizeofResource

(the first three should be used in the given sequence)

Also, a file can be addressed via the res:// protocol from the browser.

--
Serge
Nov 17 '05 #4
"Serge Baltic" <ns*@hypersw.net> wrote in message
news:c8**************************@news.microsoft.c om...
DL> It is possible Steve, see "User-Defined Resource" in MSDN.
and be able to treat it as a file from within the application.

DL> You'll need to treat it as a stream of data.

You could make use of the following functions to extract it at runtime:

FindResource
LoadResource
LockResource
SizeofResource

(the first three should be used in the given sequence)

Also, a file can be addressed via the res:// protocol from the browser.

Hi Serge,

Thanks for the reply. I'd prefer not to read it at all if possible - the
application doesn't need to read the contents of the file, just be able to
copy it to a local disk location. But I guess writing it as a stream is a
reasonable solution and certainly seems to be much easier looking at the
API.

Thanks again,

Steve
Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Fredrik Henricsson | last post by:
Hey, I'm building an ontology in Protégé and I want to transform parts of it (e.g. the instances) to HTML with XSL. When I was transforming another file with 'simple' XML-tags like <author> before,...
0
by: Ramesh K | last post by:
Hi All, To debug a C++ program running under DLLHOST, i am attaching to the DLLHOST process..even after detaching, dbgproxy.exe is holding a file reference(HANDLE) to the C++ COM component. So...
0
by: Ramesh K | last post by:
Hi All, To debug a C++ program running under DLLHOST, i am attaching to the DLLHOST process..even after detaching, dbgproxy.exe is holding a file reference(HANDLE) to the C++ COM component. So...
1
by: Namratha Shah \(Nasha\) | last post by:
Hi All, This is a resource file generation tool which converts an xml based resource formats to .net resource file i.e. (.resources) and vice-versa. Today we will see how we will generate ...
3
by: al | last post by:
Hi, I use a resource file (.resx) to store user's settings such as language and other strings. The problem i'm facing is that when the user changes one of the strings in the resource file, ...
2
by: vhg119 | last post by:
Is there a way to create a DOM document object to hold the contents of an external html? I have two pages: content.html contains some content. index.html would like to access the contents of a...
11
by: Alan T | last post by:
I added a resource file into my project, to store the caption of buttons and labels.. How do I make use of this resource file to dynamically assign to the buttons and labels ?
13
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains...
12
by: TS | last post by:
i have a need to possibly enable mutli language support. What benefit do i get by using a resource file instead of a custom xml solution? thanks!
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.