Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

Icon

This property has two similar, but slightly different, meanings. For forms (and _SCREEN), it specifies the icon in the corner of the title bar. In that case, it’s the OOP equivalent to the old ICON clause of DEFINE WINDOW. For projects, it indicates the icon that’s used for an EXE built from the project. In that meaning, it’s the same as what you specify through the Attach Icon check box in the Project Information dialog.

Usage

frmForm.Icon = cIconFile
cIconFile = frmForm.Icon
prjProject.Icon = cIconFile
cIconFile = prjProject.Icon

The file specified by cIconFile needs to be an ICO file, not a BMP or other graphic. Visual FoxPro 6 and later versions include some ICO files in the Gallery\Graphics, and Visual Studio offers a bunch more under the Common\Graphics\Icons directory. (You can avoid hard-coding those paths by taking advantage of the new parameters to HOME(). However, in VFP 7 and later, you don’t automatically get paths to Visual Studio.) Be sure to include the icons used by your forms when you distribute your application. You should build them into the APP or EXE so you don’t forget. Once you do so, you don’t need to distribute the icon files separately.

Example

* Choose a new icon for the main FoxPro window
_Screen.Icon = GETPICT()

* Specify the icon for a form from within a method of that form
This.Icon = "F:\VFP\GALLERY\GRAPHICS\MUSIC.ICO"

See Also

Define Window, Home(), Modify Window, Picture, Project, _Screen