Visual FoxPro Tips
 
Using your own icon in the .exe
 
First you will need an icon for your program. You can either use one of the collection included with VFP or create your own. To use one of the included ones, check out the graphics directory on your computer. For example, with the default installation of VFP6, the directory is "C:\Program Files\Microsoft Visual Studio\Common\Graphics\Icons\".
 
To create your own icons, you need an icon creation utility. We use a shareware program called IconForge. To download a copy, visit the publisher's web site:
 
http://www.cursorarts.com/ca_if.html
 
Here's the trick when you make your own icons: The images used must be 16 colors only. If you use 256 colors, the Fox logo icon will be shown instead of your own! You must also include the correct size images in the icon.
 
An icon file can contain several images at different sizes. Windows selects the appropriate size for the display. For example, if you are browsing a folder with Windows Explorer and you have your view set to "list", you will see the small version of the icon. However, if you're view is set to "icons", you will see a larger version. For VFP .exe files, create an icon with 16*16 and 32*32 sizes.
 
When your icon is ready, add it to your project. Click on the "Other" tab in the Project Manager window, click on "other files" and click on the "Add" button. Select "icon" from the file type drop-down then select the icon file and click on "OK".
 
Next add the icon to the .exe file. While your project is open, Press Ctrl-j to open the Project Information box. Make sure the "Attach icon" box is checked, and click on the "Icon" button. Now use the Open box to select your icon.
 
If you would like to also change the title bar icon in Windows, add this code to the main program of your application:
 
_screen.icon="<myIcon>.ICO"
 
Compile your .exe and browse the folder in Windows Explorer to see how the icon looks.
 
This tip is provided to you by Foxy Classes. For more Visual FoxPro tips, click here.
 
 
   
   
Send mail to webmaster@engineerica.com with questions or comments about this web site.
Copyright 2002-2003 Engineerica Systems, Inc.