PDA

View Full Version : Adding an Icon and Application Information



jasonf
26-06-2007, 11:14 PM
OK, it's in Turbo Explorer, It's Crashblock and I want to add an Exe icon and copyright information. I've added a runtime icon for the window. now I just need an icon to show up in Explorer.. any ideas?

It's really late - so it's probably really simple.

Robert Kosek
26-06-2007, 11:31 PM
ROFL, extremely so. :D Get ready to kick yourself...

CTRL-F11; 2nd & 7th tree-items.

czar
26-06-2007, 11:54 PM
Talking about icons.

Has anyone got experience with the new png icons that are used in Vista? What do you use to create them and how do you add them to an existing project so that it looks good in vista and xp?

jasonf
27-06-2007, 12:11 AM
CTRL+F11 just performs an Add to Project, also for this project, the Application and version info pages are all disabled.. Nice try though 8)

Legolas
27-06-2007, 12:37 AM
I guess yours is a no vlc app, right? If so, add {$R *.RES} somewhere in your main unit, then shift-ctrl-f11 and "Version Info" should be enabled :)

Robert Kosek
27-06-2007, 01:14 AM
CZAR, I use either IconDeveloper (http://www.stardock.com/products/icondeveloper/) (commercial) or IcoEffects (http://icofx.xhost.ro/) (freeware) depending on my mood/project.


JasonF, you can always write a RC script. The cheaters way is to put something like this:
1 ICON "Icon_1.ico"into a file like, "application.rc"; then (in a separate explorer window) drag that file to the brcc32.exe (Borland Resource Compiler) to create a .RES file. I hacked the definitions of my old PC to give RC scripts an extra menu item to let me easily compile them. :D

It's a commandline app you can use to learn more if you want. Or, you could define whole dialogs that way if you wanted.

jasonf
27-06-2007, 07:18 AM
@Legolas, That worked for version info, I've now got copyright info etc built into the Exe, which is important. Thanks 8)

@Robert, I think I need to research a bit more before I understand what you mean. :?

I think that because my game is just a program (not even a console app), it doesn't give the option to set an icon, I'm guessing that's because there are no forms.. but that shouldn't stop me from including a file Icon..

Anyway, I'll look into what you said Robert.

jdarling
27-06-2007, 12:55 PM
Jason, are you in FPC or Delphi? There is quite a difference in how you set up the icons in each :). Also a version would help in this case, as in D4-D6 you could do it no matter what. In D7 I believe you create a resource file and name the icon APPLICATION and it will pick it up (I'd have to go back and look again to make sure). After D7 I have no idea.

In FPC you have to create a Lazarus Resource (LRS) and link it at compile time. Some place I have an example if you need one.

cairnswm
27-06-2007, 05:23 PM
One of the articles I wrote for PGD covers how to do this for windows applications.

http://www.pascalgamedevelopment.com/viewarticle.php?a=58&p=1#article

Robert Kosek
27-06-2007, 05:43 PM
One of the articles I wrote for PGD covers how to do this for windows applications.

http://www.pascalgamedevelopment.com/viewarticle.php?a=58&p=1#articleThat only works when Delphi includes the resource wizard; turbo delphi doesn't. Meaning he has to "brute force" the resource file by using a RC script to compile to a RES file.

Icon 1 is almost always the file icon (not the application window), and you could look it up in how to create an icon group from the script and set "MAINICON" to the ID/Name of the entry.

Chebmaster
28-06-2007, 09:50 AM
I didn't touch that piece code for very long, but look how I do it:



{$ifdef win32}
{$r chentrah.res} //the application icon
{$endif}

.........

with wndClass do
begin
style := CS_HREDRAW or // Перерисовывать окно целиком при изменении ширины
CS_VREDRAW or // ...то же, для высоты
CS_OWNDC; // Окну нужен собственный контекст устройства
lpfnWndProc := @WndProc; // Оконная процедура, которая будет ловить мессаги
{$ifdef fpc}
hInstance := System.HInstance;
{$else}
hInstance := SysInit.HInstance;
{$endif}
lpszClassName := PChar(s);
hIcon:=LoadIcon({$ifdef fpc}System.HInstance{$else}SysInit.Hinstance{$endi f}, PChar('ICON_0'));
end;
-- and then this class used to create the application window.

The *.res file was created using some third-party tool (the one included with FPC didn't work) from an .ico drawn in GIMP (which is able to save multi-layer images as multi-variant icons)