en-us/about_IconForGUI.help.txt

TOPIC
    about_IconForGUI
 
SHORT DESCRIPTION
    The IconForGUI module is a set of commands for dealing with icons to be used in Windows Forms and Windows Presentation Foundation applications.
 
LONG DESCRIPTION
    The PowerShell IconForGUI Module contains four script Cmdlets: Get-IconFromFile, Get-AssociatedIcon, Get-ImageSourceFromFile, and ConvertTo-ImageSource with the aliases gif, gai, gisf, and ctis respectively.
 
    Windows Forms uses System.Drawing.Icon for its icons while Windows Presentation Foundation uses System.Windows.Media.ImageSource derived classes for its icons and images.
 
    The problem is that extracting icons from .exe and .dll files is done using Windows API, although System.Drawing can get the icon associated with a file or program, while ImageSource can do neither. This set of commands enables the retrieval of icons from .exe, .dll, and bitmap files (.png, .ico, etc.) to be used for Windows Forms applications or converted to an ImageSource for use in WPF applications.
 
EXAMPLES
    PS C:\> Get-IconFromFile -Path setupapi.dll -Index 21
 
    This command will get the icon at index 21 of the setupapi.dll library as a System.Drawing.Icon.
 
 
    PS C:\> Get-AssociatedIcon -Path C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
 
    This command will get the icon associated with the executable powershell.exe as a System.Drawing.Icon.
 
 
    PS C:\> Get-ImageSourceFromFile -Path C:\SomeBitmapImage.ico
  
    This command will get the icon specified at the path as an ImageSource derived System.Windows.Media.Imaging.BitmapImage object.
 
 
    PS C:\> Get-IconFromFile -Path setupapi.dll -Index 21 | ConvertTo-ImageSource
 
    This command will get the icon at index 21 of the setupapi.dll library as a System.Drawing.Icon and then convert it to an ImageSource derived System.Windows.Interop.InteropBitmap object.
 
KEYWORDS
    Icons WinForms WPF GUI
 
SEE ALSO
    Get-Help Get-IconFromFile
    Get-Help Get-AssociatedIcon
    Get-Help Get-ImageSourceFromFile
    Get-Help ConvertTo-ImageSource