Self-installer for Delphi win32 application - delphi

Are there any components or 3rd party software to create the self-installer Delphi application?
I want to make some kind of one-click installer which will copy the main exe file and few other files to AppData folder and create the shortcuts. It should contain only one installation screen with few settings.
I just can't find any installation builder which will create such one-click installer.
Guess I have to store all my additional files (including uninstaller) as the resources inside of the single exe, and then unpack them into the destination folder. Maybe you know some more effective method?

Use InnoSetup. This can be configured/scripted to do automatic installations and does not cost anything.

Use NSIS installer (Nullsoft (winamp) installer.
It is very simple and configureable.
http://nsis.sourceforge.net/Main_Page

Related

What can cause DCLUSR.$$$ access denied error whilst installing a user defined component

I have found the component TColorbutton and am trying to install it in Delphi 10.4.2. I know that is currently embedded in FMX, but I want it available in VCL. However, the installation fails:
Failed to save project "c:\program files (x86)\embarcadero\studio\21.0\lib\win32\release \dclusr.dproj". The following error occurred while saving: Cannot create file "c:\program files (x86)\embarcadero\studio\21.0\lib\win32\release\dclusr.$$$"
What can I do to get it installed? Or, is there a way to use the FMX version within VCL?
The installation fails because you are trying to install the component while its unit is under the C:\Program Files (x86) folder. Since this folder is one of the protected system folders, Windows prevents Delphi from creating necessary files during compilation.
You should move the component File to a non-protected folder, like C:\Users\<YourUsername>\Documents\Embarcadero before you try to install it. This way, Delphi won't be blocked by Windows while compiling the needed component package.
It seems you're trying to "extract" a component from the FMX lib and "move it over" to the VCL lib. DO NOT DO THAT!!! If you THINK you got it to work, you probably hosed-up your installation.
You didn't say what library you installed this into, but you should always install your own components into your own component library. I use one that I call "AddOns". Some people use their name. If you try to install it into one of the system libs, you're going to find it impossible to install Delphi updates as well as any libraries that depend on those components. NEVER UPDATE DELPHI COMPONENT LIBRARIES!!! (Yes, you CAN, but just DON'T!)
VCL and FMX use totally different approaches to writing to the screen (among other things), which is why they are separate libraries. FMX has a layer between the component and the platform's "screen" (OpenGL I believe), while VCL calls the Windows API directly.
If there's stuff in FMX that you'd like to see in VCL, then look for a VCL-specific component that does what you want. Or build your own that derives from an existing one.
Search Google for TColorButton and you'll find several references to things you can use. There are some on Torry's.
There's an article on it in the newer about.com site (ThoughtCo.com) but I couldn't find a link there to the source code.
Google is your friend. Try this:
https://www.swissdelphicenter.ch/en/showcode.php?id=1100

load/using .jar or .so with delphi xe5

I would like to use the lib https://sourceforge.net/p/zbar/news/2012/03/zbar-android-sdk-version-01-released/ with delphi XE5, but the lib and. Jar and. So, You can use it with delphi XE5, how do? I need to read the barcode on my webcam!
Take a look at Using a Custom Set of Java Libraries In Your RAD Studio Android Apps. I understand that there was a lack of information on this topic in 2013, but now it is described in the documentation.
There are two different approaches that you can follow to add your Java libraries to your application for Android:
Use the Project Manager to add your Java libraries to your application. This is the simplest approach, you only need a couple of clicks. This approach should work for most people.
Create and deploy a classes.dex file manually. This approach allows you not only to add libraries to your application, but also to modify the built-in RAD Studio Java libraries for Android, or remove those that you do not need.
Add a Java Library File (.jar) Using the Project Manager (XE7 Way)
In the Project Manager, extend the Target Platforms node of your project. Within the Target Platforms node, extend the Android node.
Right-click the Libraries node and select Add.
In the dialog box that opens, select the .jar file that you want to add to your application for Android, and select Open.
Now the Project Manager displays your custom Java library under the Libraries node.
You can now use your Java library.
Remember to create a native bridge file for your Java library if you do not have one yet.
Create and deploy a classes.dex file from JARs manually (Old Way)
Once you have determined which JAR files your Android applications need, you can create a classes.dex file from them.
To create a classes.dex file, you need to use the command-line tool dx. You can find this command-line tool at C:\Path\To\Embarcadero\Studio\Version\PlatformSDK\adt-bundle-windows-x86-20131030\sdk.
Run dx with the --dex parameter, the --output parameter with the output path of the classes.dex file as its argument, and a space-separated list of paths to the JAR files that you want to include in the generated classes.dex file. For example:
dx --dex --output="classes.dex" "C:\Path\To\Library1.jar" "C:\Path\To\Library2.jar"
Note: You should create both a debug and a release version of your classes.dex file. The RAD Studio debugging features are only
available if the deployed classes.dex file contains the debug
versions of the included RAD Studio built-in Java libraries.
Deploying the `classes.dex` File
Warning: Follow these steps carefully. Android applications must always include a valid classes.dex file.
To configure your Android application to be deployed with your custom classes.dex file:
Select 'Project > Deployment' to open the Deployment Manager.
Uncheck the checkbox of the default classes.dex file.
Click the Add Files button and add your custom classes.dex file to the list of deployment files.
Change the Remote Path of your new entry to classes\.
Change the Platforms of your new entry to Android only.
See Troubleshooting in case if your app does not start after manipulations with the classes.dex file.
There is a library for Delphi XE7 for reading/scanning barcodes. This library was released in 2015 and is actively supported.
ZXing.Delphi - barcode scanning object Pascal library for Delphi XE7-Berlin.
So now if you want to read the barcode on a webcam, you don't need to tinker with .jar / .so files.

Can I install Delphi IDE from the InstallAware setup.exe without copy files to c:\programdata?

Delphi IDE uses InstallAware as installer in last few releases (2010, XE, XE2, XE3, XE4). Using the normal setup.exe installation will copy a few GB of files into c:\programdata if you install all the IDE releases.
The installer consumes disk spaces quickly especially for users who use an SSD hard disk that is expensive.
Is it possible to setup the Delphi IDEs without copying files to c:\ProgramData? Is it advisable to delete those files manually after installation too? Uninstalling a previous version of the IDE does delete these files but as component maker, I need those IDEs for testing.
Partial answer here.
Is it advisable to delete those files manually after installation too?
Of course, official answer is NO. But you actually can delete these files at the cost of losing installer's "Repair" capability. (Repair is standard MSI feature, and InstallAway is merely yet another front-end for MSI). Also, it will render any manual restoration of particular file impossible, since files are stored in encrypted 7-zip archives on distribution medium (yet another unfriendly feature).
Unfortunately, I do not know any way to disable creation of such local copy of distribution medium.

How to correctly set "Directories/Conditionals" and "Library" path

How to set "Directories/Conditionals" in Project Options and "Library" path in Environment Options? Delphi help don't say much about these very important settings. I have all kind of strange errors because of wrong dependencies between my VCLs.
1.
I have merged a large set of 3rd party controls in a package called ThirdPartyPackages_D7.dpk. This is useful when I reinstall Delphi because I don't have to reinstall all those 3rd party VCLs amnually.
Then, I have my own controls in MyControls_D7.dpk which depends on the ThirdPartyPackages VCL. I also have another package BlgPackage.dpk that depends on MyControls.
At the end of the chain is my application (DPR project) which is using the controls in BlgPackage.
ThirdPartyPackages.dpk -> MyControls.dpk -> BlgPackage.dpk -> MyApplication.dpr
When I change/edit something to the second package (MyControls.dpk) and build the DPR application, it works. The compiler sees the changes made into that package.
However, if I close the project and load and compile the BlgPackage, it throws a nasty message that function xyz cannot be found in MyControls because I delete it (I have loaded MyControls' units into IDE in parallel with application's units). It seems that building the application only refreshes the DCU files for all used packages but not the DCP/BLP files.
How do I write and compile the code in the packages without explicitly loading the packages into the IDE and building them?
(Note: I have a nasty bug that does not allow me to switch between projects without restarting the IDE or to load a group of projects/packages (*.bpg) at the same time.)
2.
Another problem is that I want to store the compiled files (DCP/BPL/DCU) of a package in its folder (for example c:\MyProjects\Blg).
If I set the "Output directory", "Unit output directory" and "DCP output directory" boxes of BlgPackage package to its folder, not only its BPL/DCU/DCP files will be stored there but also the BPL/DCP files of MyControls will be stored there.
How can I have the binary files of each package in a separate folder?
Delphi 7, Win XP, all projects set to "Rebuild as needed"
You should explicitely compile packages - just compiling package files is not enough and as you have noticed leads to problems.
In modern Delphi versions you can create a project group (not sure about Delphi 7) that contains an application and packages you want to develop with the application, and you can easily switch between them and complile packages without need to close/reopen the application.
BlgPackage should not have an access to MyControls package sources (through "Library" path or by using the same directory), it should access only already compiled MyControls package, else the files from MyControls are compiled every time you build BlgPackage and the compiled files are stored in BlgControls DCU directory
ADDED
The "Library" path should lead to compiled files (.dcp, .dcu) and (if needed) resource files (.res, .dfm) only - it is enough to compile applications and packages that requires "MyControls" package. You can set the directory for compiled files directly in the package settings, and you should copy the resource files (if you need them) to the same directory manually. This directory should be included into "Library" path, or else you can use a directory already contained in "Library" path.
The "Library" path should not lead to source files (.pas) if you don't want these files to be compiled every time you build your BlgPackage or an application that requires "MyControls" package.
I use much simpler way for 3rd partie components and reinstalling Delphi.
Open regedit and find
[HKEY_LOCAL_MACHINE/SOFTWARE/Borland/Delphi/xxx] where xxx is version and export whole
branch.
Open file and delete keys LMKEY, LMLIC.
Copy C:\Program Files\Borland\Delphi x\Projects\Bpl folder to another location
Copy C:\Program Files\Borland\Delphi x\Imports to another location
Reinstall Delphi including any updates and GExpert
Import previously saved registries
Restore Bpl And Imports Folder
And whoala, Delphi is back with all 3rd partie components and IDE settings. Only limitation is that all components must reside in same folder before and after reinstalling Delphi.
This also restores TeamSource settings. If you are reinstalling Windows as well, be sure to make windows user with same user name as before.
MY solution (kinda dirty, but hey it works):
I put ALL 3rd party libraries.controls in a single package (a super-package). I put all my controls in a single package.
Now, when I migrate the packages to a different PC all I have to do is to copy/paste two folders and set two paths.
Works for me - others may not agree with it and I can't blame them. I blame the 'hell designers' from Borland/Embarcadero. If you look on StackOverflow you will see that until now nobody provided an elegant solution to this.

InstallAware problem with Delphi 2010

I am trying to create an installation disk with InstallAware Express for my Delphi 2010 application. I have selected (checked)
CodeGear Database Express12
CodeGear Visual Component Library 12
for Application Runtime.
When I try to build it, I will get an error message
Error during build: No files matching pattern "C:\Windows\system32\*120.bpl"
The message will go away if I un-check the above runtime but of coz the program will not run.
Can someone please tell me what I am doing wrong?
Also... I have use their scan file button to scan the dependent files base on my application.exe and installaware put a list of files in the $TARGETDIR$, should I leave them there or I am suppose to move them to various folder (e.g. some of the files are from the windows\system32 directory...)
Thanks a lot.
FWIW, one of the great things about Delphi is that you can pretty much install on any system without worry if you turn off the "build with packages" option. This would eliminate the need for these files, and solve your problem, and also make the application more robust against updates and changes. IMO packages are only needed if you are building multi-module applications which are more advanced, and in that case you wouldn't want to be using any Express installer.
You can manually add the files.
To find out which VCL packages your application uses, open the project in the IDE. Use the menu item Project->Build project to rebuild your entire application, and then use Project->Information to view the information dialog. The list of packages actually required by (and therefore needing to be distributed with) your application are listed there.
Where to install them on the destination system depends on why you're using packages in the first place. If you're using runtime packages simply to reduce the download size for your users, and the packages will only be used by this single application, put them in the same folder as your application ($TARGETDIR$). If you're using them because you've got several different applications, and they'll all be installed in different locations but use the same runtime packages, install them in the System32 folder ($SYSDIR$, if I remember correctly).
InnoSetup works fine with runtime packages manually added, btw, especially if you use the excellent (and also free) ISTool IDE. (Not affiliated in any way; just a happy customer.)
Did you have Delphi 2010 installed on this machine? If so, you should see several bpl files under C:\Windows\system32 folder.

Resources