HOW TO: Add an Application Icon to a Visual J# .NET Application (324969)



The information in this article applies to:

  • Microsoft Visual J# .NET (2002)
  • Microsoft Visual J# .NET (2003)

This article was previously published under Q324969

SUMMARY

This step-by-step article describes how to add an application icon to a Visual J# .NET application.

The Microsoft Visual Basic .NET and Microsoft Visual C# .NET /win32icon compiler option inserts an icon (.ico) file in the output file, which gives the output file the appearance that you want in Windows Explorer. The Visual J# .NET compiler does not support the /win32icon option. To work around this, you can create a resource compiler script file for the icon, and then create a resource (.res) file by using the Rc.exe utility. You can add the resource file to a Visual J# .NET application by using the compiler /win32res option.

back to the top

Add an Application Icon to a Visual J# .NET Application

  1. In Notepad, use the following code to create a resource compiler script file that references the icon:
    1	ICON	"icon.ico"
    					
  2. Save the file in Notepad as Icon.rc.
  3. Run the following at a command prompt to create a resource (.res) file named Icon.res:

    rc icon.rc

  4. Compile the Visual J# .NET application and reference the icon resource file (Icon.res) by using the /win32res option. You can do this from the command line or in the Microsoft Visual Studio development environment. To do this from the command line, run the following command:

    vjc /win32res:icon.res app.jsl

    To do this from the Microsoft Visual Studio development environment:

    1. Open the Property Pages dialog box for the project.
    2. Click the Configuration Properties folder.
    3. Click the Advanced tab.
    4. Add the following to the Additional Options property:

      /win32res:icon.res

    The resulting .exe file will have the appropriate icon next to it when you view it in Windows Explorer.
back to the top

Modification Type:MajorLast Reviewed:8/7/2003
Keywords:kbIcon kbWindowsForms kbHOWTOmaster KB324969 kbAudDeveloper kbAudITPro