Delphi7 Remove/Restore MAINICON from Project - delphi

In Delphi7 you can assign/load an icon to a project. After every compilation your application has the assigned icon. I would like to delete/restore the icon back to the original Delphi7 Icon. I can't find a button/option for this. I also tried deleting the .res file but no luck.
Any Ideas?

The icon is stored in the .res file.
If you delete/rename your .res file with the project open in the IDE, maybe the .res data is already loaded and then will be saved again to the new .res.
Anyway, if excluding the .res file is not solving your problem, you can open the .res file with a resource editor tool (XN Resource Editor for example) and export/change/delete the MAINICON resource as you want.

Related

How to insert multi-size icon file using RC.EXE?

I created a multi-sized icon file for my application. Now i'm using a .rc file to link the icon to my app. Here is the contents of my .rc file :
MAINICON ICON myapp.ico
The file is compiled by RC.EXE, but no icon is added into my application; it keeps using the default Delphi's icon :
What am i missing ?
Thanks
The icon you specify in your *.rc file does indeed get included in the EXE, as you can easily verify using a resource editor. However, if you build using the IDE, so does the icon specified in the Project Options, and that one becomes the main icon of the application.
I almost would expect the Project Options dialog box to have some option not to include an icon, but I cannot find any such option. You can add or change the icon, but you cannot remove it if it is already there.
However, it seems like you can remove it yourself by editing the *.dproj file behind the back of the IDE:
Make sure the project is NOT opened in any instance of the Rad Studio IDE.
Open the *.dproj file in a text editor.
Remove the <Icon_MainIcon> line(s).
Save the file.
Now, if you open the project in the IDE and build it, the IDE will not insert any icon, so your icon specified in the *.rc file becomes the application icon.

Delphi .proj file missing .dpk file

I recently got project in delphi which I need to rearange, I'm totally new in delphi so I'm searching my way in environment and language. Question, in my project group I have two files with .dproj extension, no corresponding .dpr file so when I try to load them I got msg:
"Canot open file xxxx.dpk, system cannot find the file specified"
Did the old programmer forgot to copy all files so I'm missing this, or is this some kind of file (.dproj) that I only add as a reference so I don't need to have corresponding .dpk or .dpr file??
The .dpk file is the top level Pascal source file for a package. It is the package equivalent of an application project's .dpr file.
The original developer should have supplied it to you. Ask them to do so.

Unable to open or even add Resource files in my Delphi 7

Every single time i either try to open or add a resource file to my project or just open it within delphi it will throw me an error (I have tried .rc,.res,.rc..all kinds of extensions) and it will say that the file has been truncated or that Delphi cannot open or add this type of file. any ideas?
You cannot open a .res file in the Code Editor, as it is a binary file. You can open an .rc file, as it is a plain text file.
You can certainly add both .rc and .res files to a project, though. The IDE should not complain about that.

Application icon stuck DELPHI XE5

The first time i update the icon in "project > Options > Application > Load Icon..." the icon as changed as it should, now every time i change the application icon, my app keep compiling with The old icon even if i click in "project > Options > Application > Default" or try to load a new one
The icon get stuck somewhere, but where ?
There's a way to force icon with resource file or unstuck the old icon ?
I download a icon which is a multi size ico file ( one ico file, 8 sizes )
i already try :
Reboot my computer.
Change the .exe name.
Copy the .exe to another computer.
same error.
For Windows platform, the icon (and version info) is stored in resource file (.res). And by default Delphi project includes in exe all the .res files it founds in project directory (see {$R *.res} directive in your .dpr file).
So check all the .res files you have in your project directory to find out which of contains the default icon. You can use any resource editor for that.
Then, just delete that file, but please keep backup, cause .res file may contain other important information.
Had the same experience recently as well.
The "default" button does not seem to work as soon as you have selected an icon.
I got rid of the icon via the following steps:
Close your project.
In your project folder an icon will be created with the name "Projectname"_ICON.ICO.
Rename or remove this Icon.
Reopen your project,
Get to Project->Options,
An error message will be raised at every configuration in which you have used the icon, but by pressing default the message will not reappear,
Now the project is forced to use the default icon again.
Probably there is a more sophisticated manner, but I have not found it elsewhere.
This was what helped me:
You can just run the following command to clear the icon cache:
ie4uinit.exe -ClearIconCache
For Windows 10, use:
ie4uinit.exe -show

How to interpret .otares file in Delphi XE2?

There is a new file [project-name].otares created in Delphi XE2.
The wiki says:
File with unknown resources generated during upgrade of pre XE2
project. (Unknown resources are resources that are not included in the
build configuration, like version info, icon, manifest or styles.)
How I can read this binary file meaning. Which resources exactly haven't been migrated?
After opening the otares file with ResEdit tool I displayed the information I needed:
You can open the file in a resource editor, for example: XN Resource Editor, ResEdit, Resource Hacker, Visual Studio etc.
Somehow such a file was created in a new package of mine by Delphi 11. A warning was being issued at compile time that duplicate resource from .res file was discarded. Also at other Delphi 11 installation it didn't build anymore without an error message (just that warning which didn't cause build issue at the other project).
Solution was to right click the project and pick "View source", then remove the {$R *.otares} that had been placed before the {$R *.res} in the .dpk file (for app project instead of package project it would be the .dpr file)

Resources