Deutsch Deutsch  
Heaventools Home Page
Product Overview Solutions Download Support Purchase About

 

  RESOURCE TUNER CONSOLE :: REAL WORLD EXAMPLES
Command-line script driven resource editor

Product Name:

Resource Tuner Console (RTC)

Version:

1.70

Release Date:

September 10, 2008   [What's New]

Requirements:

Intel Pentium with 16 MB RAM (or higher)

Platforms:

 Windows 98, ME, NT4, 2000, XP, 2003, Vista

Price:

 $199 (Single Developer License)

Trial Version
Download

 Resource Tuner Console (2.00 Mb)


OVERVIEW

SOLUTIONS

DOWNLOAD

GETTING STARTED

SAMPLE SCRIPTS:
 
    • Overview
    • Process Folders
    • Test Script
    • Edit Icons
    • Edit Strings
 

ORDER NOW

REQUEST SUPPORT

ABOUT US

Edit Icons: Replacing an Icon Resource With an Icon From an .ICO File

This code shows the way you can replace icons in EXE and DLL files using VBScript in RTC.

The script adds or replaces icons in the demo EXE (which shipped with the RTC package) with icons from .ico files in the "..\Demo\Src" folder. It also outputs the resource tree to a log file and/or the console screen. The resulted file is saved to the Destination folder.

'------------------------------------------------------------------------------
'
' This code shows how to modify icons in executables.
'
' The script will add or replace icons in demoapp1.exe with icons from .ico
' files in the "..\Demo\Src" folder. 
'
' The resulting files will be created in the directory named "..\Demo\Release"
' Check the log file to see the Resource Tree built. 
'
'------------------------------------------------------------------------------

Sub Main
  PEFileProxy.PostDebugString "Updating the checksum in the PE file header is enabled." 
  PEFileProxy.UpdateCheckSum = True 

  PEFileProxy.PostDebugString "The creation of a backup copy is disabled." 
  PEFileProxy.CreateBackUp = False 

  PEFileProxy.PostDebugString "Opening a file..."
  PEFileProxy.OpenFile "..\demo\src\demoapp1.exe"
  if (PEFileProxy.Terminated) then
    PEFileProxy.PostDebugString "Opening a file produced a fatal error."
  else
    PEFileProxy.PostDebugString "File successfully opened."
    if (not PEFileProxy.HasResources) then
      PEFileProxy.PostDebugString "The file contains no resources."
    else
      PEFileProxy.PostDebugString "The file contains resources."

      LangID = 0 ' Default

      PEFileProxy.PostDebugString "Changing/adding the main application icon..."
      ResourcesProxy.ChangeIcon "", LangID, CREATE_IF_NOT_EXIST, REPLACE_IF_ITEM_EXISTS,
 "..\demo\src\icon_1_32x32_4bit.ico"
      ResourcesProxy.ChangeIcon "", LangID, GET_DEFAULT_IF_NOT_EXIST, REPLACE_IF_ITEM_EXISTS,
 "..\demo\src\icon_2_16x16_4bit.ico"

      PEFileProxy.PostDebugString "Adding two more icons..."
      ResourcesProxy.ChangeIcon "1", LangID, CREATE_IF_NOT_EXIST, REPLACE_IF_ITEM_EXISTS,
 "..\demo\src\icon_3_32x32_8bit.ico"
      ResourcesProxy.ChangeIcon "1", LangID, CREATE_IF_NOT_EXIST, REPLACE_IF_ITEM_EXISTS,
 "..\demo\src\icon_4_16x16_32bit.ico"

      PEFileProxy.PostDebugString "Compiling all changes..."
      PEFileProxy.Compile

      PEFileProxy.PostDebugString ""
      PEFileProxy.PostDebugString "Resource Tree built by RTC:"
      ResourcesProxy.ResourceTreeToLog
      PEFileProxy.PostDebugString ""

      PEFileProxy.PostDebugString "Saving file as a new file..."
      PEFileProxy.SaveAsNewImage "..\demo\release\demoapp1.exe"
    end if
    PEFileProxy.PostDebugString "Closing this file..."
    PEFileProxy.CloseFile
  end if
end Sub
'------------------------------------------------------------------------------

RTC outputs the Resource Tree to a log file, so you can see the changes made:

Resource Tree built by RTC:
----------------------------------------
 [Cursor (1)]
     1: 32x32 1b, Neutral (0)
     2: 32x32 1b, Neutral (0)
     3: 32x32 1b, Neutral (0)
     4: 32x32 1b, Neutral (0)
     5: 32x32 1b, Neutral (0)
     6: 32x32 1b, Neutral (0)
     7: 32x32 1b, Neutral (0)
 [Bitmap (2)]
     BBABORT: Neutral (0)
     BBALL: Neutral (0)
     BBCANCEL: Neutral (0)
     BBCLOSE: Neutral (0)
     BBHELP: Neutral (0)
     BBIGNORE: Neutral (0)
     BBNO: Neutral (0)
     BBOK: Neutral (0)
     BBRETRY: Neutral (0)
     BBYES: Neutral (0)
     CDROM: Neutral (0)
     CLOSEDFOLDER: Neutral (0)
     CURRENTFOLDER: Neutral (0)
     EXECUTABLE: Neutral (0)
     FLOPPY: Neutral (0)
     HARD: Neutral (0)
     KNOWNFILE: Neutral (0)
     NETWORK: Neutral (0)
     OPENFOLDER: Neutral (0)
     RAM: Neutral (0)
     UNKNOWNFILE: Neutral (0)
     XCLR_BMP: German - Switzerland (2055)
 [Icon (3)]
     * 1: 32x32 4b, Russian (1049)
     2: 32x32 8b, Russian (1049)
     + 3: 16x16 4b, Neutral (0)
     + 4: 32x32 8b, Neutral (0)
     + 5: 32x32 4b, Neutral (0)
 [String (6)]
     4080: Neutral (0)
     4081: Neutral (0)
     4082: Neutral (0)
     4083: Neutral (0)
     4084: Neutral (0)
     4085: Neutral (0)
     4086: Neutral (0)
     4087: Neutral (0)
     4088: Neutral (0)
     4089: Neutral (0)
     4090: Neutral (0)
     4091: Neutral (0)
     4092: Neutral (0)
     4093: Neutral (0)
     4094: Neutral (0)
     4095: Neutral (0)
     4096: Neutral (0)
 [RC Data (10)]
     DVCLAL: Neutral (0)
     PACKAGEINFO: Neutral (0)
     TFORM1: Neutral (0)
 [Cursor Group (12)]
     32761: Neutral (0)
     32762: Neutral (0)
     32763: Neutral (0)
     32764: Neutral (0)
     32765: Neutral (0)
     32766: Neutral (0)
     32767: Neutral (0)
 [Icon Group (14)]
     * MAINICON: Russian (1049)
     XCLR_ICON: German - Switzerland (2055)
     + 1: Neutral (0)
 [Version (16)]
     1: English (US) (1033)
----------------------------------------
Legend: [Name (Ord)] - Type; "+" - New; "-" - Deleted; "*" - Modified

To see the changes made to the test EXEs, we recommend using Resource Tuner GUI, a visual resource editor.

 Download Resource Tuner Console and learn how it can make you more productive.


 

Download Area    How To Order    Request Support    What's New    About Us    Site Map