Recent

Author Topic: Application icon  (Read 40522 times)

LBAWinOwns

  • New Member
  • *
  • Posts: 13
Re: Use standard *.res format
« Reply #15 on: August 19, 2007, 12:33:44 am »
Quote from: "banhof"
I have it solved this way:
1.) Download resource editor, I have used XNResourceEditor (http://www.wilsonc.demon.co.uk/d10resourceeditor.htm).
2.) In XNResourceEditor create new file.
3.) In menu choose Resource > Import Image Resource
4.) Choose *.ico file which you want to use as main icon of your application
Rename group with your icon (it's name is 1) to MAINICON  by clicking on it and pressing F2
5.) Save file as resource file with name same as *.lpi file of your application is (name should be somethink like yourapplicationname.res) and place it to your application directory
6.) Open lazarus, in menu click on Project > Project Inspector and open lpr file of your project. It should be somethink like this:
Code: [Select]

program master;

{$mode objfpc}{$H+}

uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms
{ add your units here }, uMain, DBFLaz, uentry, usales, rxnew, uStock;  
begin
Application.Initialize;
Application.CreateForm(TfMain, fMain);
Application.CreateForm(TfEntry, fEntry);
Application.CreateForm(TfSales, fSales);
Application.CreateForm(TfStock, fStock);
Application.Run;
end.

You have to add {$R *.RES} directive:
Code: [Select]

program master;

{$mode objfpc}{$H+}

uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms
{ add your units here }, uMain, DBFLaz, uentry, usales, rxnew, uStock;

//Add this:
{$IFDEF Win32}
{$R *.RES}
{$ENDIF}

begin
Application.Initialize;
Application.CreateForm(TfMain, fMain);
Application.CreateForm(TfEntry, fEntry);
Application.CreateForm(TfSales, fSales);
Application.CreateForm(TfStock, fStock);
Application.Run;
end.

7.) Recompile your application and enjoy  :D


Well put, important note, so you dont get mad and stuck at this, remember that the icon cant be as big as u want, I dont know the limits, but if its not working, the size of the icon might be the fault.

LazaruX

  • Hero Member
  • *****
  • Posts: 597
  • Lazarus original cheetah.The cheetah doesn't cheat
RE: Re: Use standard *.res format
« Reply #16 on: August 24, 2007, 09:07:37 am »
HI, yeah , this is the hard way, if somebody wants to know an easyer way then there are also  simple tools to do that. Examples are: Wi(n)XtaP (created by me, LazWin, and many others, just look a bit in the forum

Technos

  • Newbie
  • Posts: 1
Application icon
« Reply #17 on: September 22, 2007, 07:58:03 pm »
Another way of assigning icon to the application is to create a resource file, i.e., app_ico.rc with the following content:



Code: [Select]

MAINICON ICON "./images/dbman.ico"


then compile into a resource:

Code: [Select]

winres -i app_ico.rc -o app_ico.res


Then in your main program adjust to include the new resource file, like:

Code: [Select]

program dbman;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  Forms
  { add your units here }, main, sqlite3laz;

{$R manifest.res}

{$R dbman.res}
{$R app_ico.res} //<-this line here
begin
  Application.Initialize;
  Application.CreateForm(TFormMain, FormMain);
  Application.Run;
end.


Regards,
Technos[/code]

antonio

  • Hero Member
  • *****
  • Posts: 605
Application icon
« Reply #18 on: September 23, 2007, 10:06:02 pm »
Using a tool is a way to reduce errors.

erlk

  • Newbie
  • Posts: 1
Help Me Please
« Reply #19 on: April 18, 2008, 02:26:48 pm »
Hello, everybody
I Have some problem with GUI my Application, when i migrate to linux(CENTOS), and my GUI Application is diferent with Win32.
i use manifest.res for my GUI Application on Win32.
if somebody know how, please tell me

 

TinyPortal © 2005-2018