Embed Large Text File into C++Builder Windows App - text

I want to embed a large dictionary text file (more than 66k words of no more than 30 characters per word, with one word per line) into a C++Builder executable to run on Windows. How can that be done?

Rather than embed the text file into the executable itself, you could just store the file in the same folder as the executable (or any other folder of your choosing), and then load the file at runtime using a TStringList object using its LoadFromFile() method.
Otherwise, if you really want to embed the file, you can store its content in a resource in the executable, by referring to the file with an .rc script added to the project (or, using the Project > Resources and Images... dialog), and then load the resource data into a TStringList object at runtime using its LoadFromStream() method with a TResourceStream. See Resource Files Support in Embarcadero's documentation for further details and an example.

Successfully used the Resource Files Support link to embed a short text list file into a sample exe file.

Related

Paraview: Create a state file in an external program

My c++ code outputs a number of vtu files and stl files. Each vtk file has a different mesh and a different number of fields. I want the user to be able to open those vtu files in Paraview together so that they are all on the same pipeline. Currently, the user has to open each vtu file separately or group select them together in the Open File dialog box and open them. But I want to give the user a better experience. I like the user to not worry about all the different but files and open just one "combined file". Is there a way to create one single file from all these vtu and stl files? Or create a single "reference" file that will reference those other vtu and STL files and the user has to open only the reference file?
If you have a way to get the list of file to load, you can create a python script alongside to your data, where you basically put:
from paraview.simple import *
# recover file list
# ...
for file in files:
OpenDataFile(file)
Then one can just load this script as a state in ParaView.

How can I use python to edit docx and/or doc file tags on a windows system?

I have a folder with a large amount of .doc and .docx files, I would like to develop a python script to edit the tags of each file so I can find a file in the folder using the tags - thus making my life a little easier.
I am unsure of how to even start and was hoping someone could point me to a library or provide some sample code to help me get started.
I am not sure if the file extenstion matters because this seems to be a windows property (right-click file > Properties > Details > Tags > type in tags) but if the extension matters I do can change all the files to be .docx
The python-docx package provides methods to access most of the metatdata in a word file. The class docx.opc.coreprops.CoreProperties in specific allows you to modify author, category, etc. I didn't see tags mentioned but if you do some more research i'm sure you can find it.
docx.opc.coreprops.CoreProperties.keywords can be used to update doc file tags.

Readout properties of a ms word document on a linux system

We want to program a pre-commit hook on our linux based svn server which executes some checks on the properties of ms word documents (e.g. author, version, etc.) during their initial check-in.
Is there any way to read out these properties with some e.g. scripting language or C++ code on a linux system?
Depending on what version of Word you're working with, possibly.
The DOCX format is really a ZIP file which contains a number of files (many XML) that make up the Word document. It's based on the Office Open XML format. If you unzip it and look in the docProps directory that's created, core.xml contains several nodes that may be of use to you: dc:creator, cp:lastModifiedBy, cp:revision. Interrogate those with your scripting language/XML library of choice.

File association and thumbnail preview in Windows 10

I have created an application and associated on registry a file extension on Windows 10, so when you double click a file associated with my extension, it opens my app with the file as parameter.
Now, I want the files associated to my application to behave in Windows 10 just like images - I mean, having a thumbnail preview, so when the user selects "large icons", he would be able to see a preview of the file.
I wonder how can I do it. What kind of metadata my file should have so Windows would recognize it and show a preview. Of course, I don't want just large icons, I want a file preview just like image files.
It isn't hard for me to generate a preview bitmap and integrate it to the file format I created (or even to change the file format completely, since I didn't publish anything yet), but how would windows recognize it? Is this even possible?
Thanks in advance
After some research, I found a sample code that does exactly what I need. It creates a thumbnail provider, which have access to the file's contents (binary), and then I can use it to generate the thumbnail of the file.
The sample that creates a IThumbnailProvider can be found here:
https://code.msdn.microsoft.com/windowsapps/CppShellExtThumbnailHandler-32399b35/view/SourceCode#content
The project should generate a dll, that we should register on Windows. It might be done using the following lines:
system32/regsvr32 ThumbnailProviderx64.dll
syswow64/regsvr32 ThumbnailProviderx86.dll
unregistering is like this:
system32/regsvr32 /u ThumbnailProviderx64.dll
syswow64/regsvr32 /u ThumbnailProviderx86.dll
Another nice sample could be found at:
http://www.codemonkeycodes.com/2010/01/11/ithumbnailprovider-re-visited/

how to add directory to SupportFiles in InstallShield

Is there a possibility to add directory (with sub directories) to SupportFiles section in installshield. I have dynamically created content (list of files changes constantly) that I use to support my installation.
Is there any other method to add dynamically whole directory to installation package. I need files from this directory only during installation process. At the end of the installation I want IS to remove these files automatically ?
The ISSetupFile table ( which drives the Support Files pattern ) only supports extracting files to a single directory. There is no way in the UI to tell it to be dynamic although you could have a build automation step that reflects the contents of a directory and wires it up to the table using the automation interface. This still couldn't do sub directories though.
What you probably want to do is creating a self-extracting zip of the files you need as part of your build and add that EXE to Support Files. Then write custom actions that call the EXE to extract the payload to Support Files and another CA to clean it up. Look for the custom action ISSetupFilesExtract and ISSetupFilesCleanup to figure out the best way to do this.
Although I'm late to the party: #BuvinJ mentioned in a comment that you can add directories to "Advanced Files" under "Disk1." In this case, they do appear in the temporary directory (support directory), eg. SUPPORTDIR\Disk1
SUPPORTDIR is a temporary location where the installer dumps files, and cleans them up afterward. An example is C:\Users\<your user name>\AppData\Local\Temp\2\{F6B9B2D6-2A5A-4146-9297-E80A199CB0CB}.
This could be a quicker/cheaper/faster solution to writing custom actions and/or packaging up files by hand in, say, a self-extracting zip file.

Resources