Grupy dyskusyjne Google nie obsługują już nowych postów ani subskrypcji z Usenetu. Treści historyczne nadal będą dostępne.

MAINICON in console app

0 wyświetleń
Przejdź do pierwszej nieodczytanej wiadomości

Will DeWitt Jr.

nieprzeczytany,
12 cze 2003, 18:29:4712.06.2003
do
I seemed to recall being able to set the main icon using the Load Icon
button from within the IDE by adding--

{$R *.RES}

Manually to the console project file, but for whatever reason, I'm only
able to use the version resource editor in the IDE, the Load Icon
button remains unavailable. Now, I could just define my own MAINICON
in another resource file and include it manually--

{$R mymainicon.res}

But the issue is, I *want* the version resource editting in the IDE to
function, specifically, I don't want to have to deal with manually
incrementing the build number. The problem is, Delphi insists on
including it's icon in the project resource file, and the compiler
complains about duplicate resources--

[Error] WARNING. Duplicate resource(s):
[Error] Type 14 (ICON GROUP), ID MAINICON:
[Error] File customico.res resource kept; file project1.RES
resource discarded.

Is there *any* way to include an icon/override Delphi's icon *and* keep
the easy version resource editting capabilities of the IDE? I looked
in the DOF file hoping beyond hope that maybe it included some method
to define an ICO file to use (since the DOF file also backs up the
version info data in case the RES file is deleted), but so far I've
come up empty. Unless there's some undocumented setting for the DOF
file, I can't see any solution to this that doesn't involve jumping
through hoops.

Anyone have any ideas?

Will

Kurt Barthelmess (TeamB)

nieprzeczytany,
12 cze 2003, 19:24:4612.06.2003
do
"Will DeWitt Jr." <ed...@boink.net> wrote:

>I seemed to recall being able to set the main icon using the Load Icon
>button from within the IDE by adding--
>
>{$R *.RES}
>
>Manually to the console project file, but for whatever reason, I'm only
>able to use the version resource editor in the IDE, the Load Icon
>button remains unavailable. Now, I could just define my own MAINICON
>in another resource file and include it manually--
>
>{$R mymainicon.res}
>
>But the issue is, I *want* the version resource editting in the IDE to
>function, specifically, I don't want to have to deal with manually
>incrementing the build number. The problem is, Delphi insists on
>including it's icon in the project resource file, and the compiler
>complains about duplicate resources--

I may be getting lost in the detail here. But I think you are saying
that you want to use version info in your resource app. Let's start
with that. Is there a problem with it? Do you get your build number
and such incremented ok? If not, there's usually a problem with the
dpr source such that the project manager can't figure out what you
have tweaked there. If you can't get that to work, please do follow
up.

Second - Delphi will always include an icon (either the one you
specify or the default) in the .res file. You can add other icons
with the {$R MYICO.RES}, but none of them can be named MAINICON or
you'll get that duplicate resource problem. And the MAINICON is the
one used for the application. So is the problem that the Load Icon
button doesn't work (may be related to the .dpr source file) or that
you want the icon to come from your own .res?

Good luck.

Kurt


Will DeWitt Jr.

nieprzeczytany,
12 cze 2003, 21:17:1112.06.2003
do
Kurt Barthelmess (TeamB) wrote:

> Second - Delphi will always include an icon (either the one you
> specify or the default) in the .res file. You can add other icons
> with the {$R MYICO.RES}, but none of them can be named MAINICON or
> you'll get that duplicate resource problem. And the MAINICON is the
> one used for the application. So is the problem that the Load Icon
> button doesn't work (may be related to the .dpr source file) or that
> you want the icon to come from your own .res?

Right, the issue is "Load Icon..." is grayed out/disabled in the
Project Options (this is a console application, not a GUI app). I've
added the line--

{$R *.RES}

To my console project file above the uses and below the 'program xxxx'
and {$APPTYPE CONSOLE} directives, it auto-created the resource file
the first time I did this and subsequently enabled the version resource
editor inside the Project Options IDE dialog, but, the "Load Icon..."
button remained disabled/dimmed.

I have now verified this as a bug in Delphi 7 by testing the same
methodology under Delphi 6. In Delphi 6, the following steps allow you
to change the "MAINICON" (app icon basically)--

1) Create a new console project.
2) Add {$R *.RES} above the uses clause and below the program clause
and/or {$APPTYPE CONSOLE} directive.
3) At this point, a message box should appear indicating that the
resource file was not found and that it was created. Press OK.
4) Go to Project | Options on the IDE menu.
5) Go to the Application tab in the Project Options. Under Delphi 6,
"Load Icon..." should be enabled and you can now change the MAINICON
resource. Under D7 the button is disabled and you can still not change
the icon. Under both Delphi versions, you can now take advantage of
the version resource editor on the "Version Info" tab of the Project
Options, including taking advantage of the auto-increment build number
feature.

I have reported this in QC as entry 4723, it is a Delphi 7 specific
issue, and it is reproducable on Delphi 7 Professional Build 4.453.

I tried something else on a hunch that it might work, so here's a
work-around that doesn't require D6--

1) Start a new GUI application (File | New | Application).
2) Go to Project | Options and on the Application tab, change the icon
to the icon you want.
3) Close the auto-created Unit1 and DO NOT save Unit1.pas.
4) Go to Project | View Source and remove the uses clause as well as
the code between the begin/end statement. Above {$R *.RES} add
{$APPTYPE CONSOLE}.
5) Between the begin/end clause, put a single call to ReadLn. Press F9
(or, go to Run | Run on the IDE menu) and check and see if your defined
icon appeared. If so, you can safely continue developing your console
application. If not.. well, it worked for me. ;)

Hopefully this'll help anyone who has come across or comes across this
issue in the future.

Will

Andrew Jameson

nieprzeczytany,
13 cze 2003, 03:07:4213.06.2003
do
I use console applications and this is what we do ... generate a .rc file
like ths one and simply add it to the project ... it replaces the default
icon with ours and Delphi compiles it all too without all the mess
associated with a resource editor. Version control is even better as we
control the versioning through an external build program that we wrote that
controls the version numbering across all of our modules and is interfaced
to source safe too.

We still use D5 ... so can't comment as to what it does with D6 or D7 but it
should be OK.

/////////////////////////////////////////////////////////////////////

// Compile into the project

100 ICON "CJInmuebles.ico"

// Version Information

LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_UK

1 VERSIONINFO LOADONCALL MOVEABLE DISCARDABLE IMPURE
FILEVERSION 1, 0, 2, 0
PRODUCTVERSION 1, 0, 2, 0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
{
BLOCK "StringFileInfo"
{
BLOCK "080904E4"
{
VALUE "CompanyName", "SoftSpot Software Limited\000"
VALUE "FileDescription", "CJ Inmuebles\000"
VALUE "FileVersion", "1.0.2.0\000"
VALUE "InternalName", "CJInmuebles.exe\000"
VALUE "LegalCopyright", "\251SoftSpot Software Limited\000"
VALUE "LegalTrademarks", "\256SoftSpot Software Limited\000"
VALUE "OriginalFilename", "CJInmuebles.exe\000"
VALUE "ProductName", "CJ Inmuebles\000"
VALUE "ProductVersion", "1.0.2.0\000"
VALUE "Comments", "by Andrew Jameson - 2003\000"
}

}

BLOCK "VarFileInfo"
{
VALUE "Translation", 2057, 1252
}

}

////////////////////////////////////////////////////////////////////////////
/

"robertbienert<AT>gmx.net" <"robertbienert

nieprzeczytany,
13 cze 2003, 12:23:4213.06.2003
do
Will DeWitt Jr. wrote:
> Is there *any* way to include an icon/override Delphi's icon *and* keep
> the easy version resource editting capabilities of the IDE? I looked
> in the DOF file hoping beyond hope that maybe it included some method
> to define an ICO file to use (since the DOF file also backs up the
> version info data in case the RES file is deleted), but so far I've
> come up empty. Unless there's some undocumented setting for the DOF
> file, I can't see any solution to this that doesn't involve jumping
> through hoops.

Well, you can change the icon manually if you edit it with the image
editor. But I think this is not the goal you expected.
--
Robert Bienert <robert...@gmx.net>
Check also my free software at http://www.rbprogs.de.vu/


Nowe wiadomości: 0