Click here to Skip to main content
13,355,292 members (59,045 online)
Click here to Skip to main content
Add your own
alternative version


21 bookmarked
Posted 12 Jan 2000

How to display the Pick Icon Dialog

, 12 Jan 2000
Rate this:
Please Sign up or sign in to vote.
Explains how to display the windows 'Pick Icon' dialog
  • Download demo project - 12 Kb
  • Download source files - 1 Kb

    Sample Image - selecticon.gif

    We all know the Pick Icon common dialog that the Windows shell displays when you choose "Change icon". However, the function to do this is undocumented. This article explains how to use this common dialog.

    You bring up the dialog by calling the function PickIconDlg. This function is exported by ordinal from shell32.dll and has ordinal 62.

    However, the function has one drawback: it has a different signature in Windows NT and Windows 95/98. Therefore, i wrote a wrapper around the function that dynamically binds to shell32.dll and converts arguments when necessary.

    I provided two versions of the wrapper function: a Unicode version and an ANSI version.

    The function returns you the name of a the file that contains the icon and the index of the icon. This is a zero-based index, not a resource id. This means you can extract the icon with the function ExtractIcon.

    The following piece of code (from the accompanying sample project) shows how to call the wrapper function:

    if (::SelectIcon(m_hWnd, m_pszCurrentFile, MAX_PATH, &m_dwCurrentIndex))
        m_hIcon = ::ExtractIcon(::AfxGetInstanceHandle(), 
            m_pszCurrentFile, m_dwCurrentIndex);
        SetIcon(m_hIcon, TRUE);
        SetIcon(m_hIcon, FALSE);
  • License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    About the Author

    Henk Devos
    Web Developer
    Belgium Belgium
    Henk studied computer science at the University of Ghent, specializing in theoretical computer science.
    He is now working for Artwork Systems, Belgium, and Whirling Dervishes Software, Belgium.
    Henk knows a little something about networking, graphics, object-oriented design, AI, embedded systems. He knows most of the PDF specs by heart.
    Henk developed NSELib, the NameSpace Extension Library.
    You can find his latest freeware software at It contains a namespace extension that puts the registry in Windows Explorer. The newest commercial project is Alpha ZIP, an explorer-embedded ZIP file utility.

    You may also be interested in...

    Comments and Discussions

    QuestionProblem with PickIconDialog in C# and Windows 2000 Pin
    nagarsoft19-Nov-05 8:43
    membernagarsoft19-Nov-05 8:43 
    AnswerRe: Problem with PickIconDialog in C# and Windows 2000 Pin
    jeremy simmons29-Jan-10 7:19
    memberjeremy simmons29-Jan-10 7:19 
    GeneralLarge or small icon add to image list Pin
    Tcpip20051-Nov-05 15:23
    memberTcpip20051-Nov-05 15:23 
    GeneralSelectIcon on VB 6.0 Pin
    Willian.BR29-Apr-04 6:23
    memberWillian.BR29-Apr-04 6:23 
    QuestionHow did you figure out the signature ? Pin
    Tom Collins9-Dec-03 4:13
    memberTom Collins9-Dec-03 4:13 
    GeneralUndocumented PickIcon dialog Pin
    Armen Hakobyan12-Mar-02 6:44
    memberArmen Hakobyan12-Mar-02 6:44 
    GeneralContextMenu on Network Neighborhood computer Pin
    soma13-Feb-01 17:09
    membersoma13-Feb-01 17:09 
    GeneralRe: ContextMenu on Network Neighborhood computer Pin
    Henk Devos13-Feb-01 23:13
    memberHenk Devos13-Feb-01 23:13 
    GeneralRe: ContextMenu on Network Neighborhood computer Pin
    soma14-Feb-01 8:51
    membersoma14-Feb-01 8:51 
    GeneralSaved me a couple hours Pin
    Matt Wigdahl14-Sep-00 5:12
    sussMatt Wigdahl14-Sep-00 5:12 
    Thanks for sharing this
    QuestionHow to save the selected icon in a file ? Pin
    Xavier Lelievre16-Jan-00 2:30
    sussXavier Lelievre16-Jan-00 2:30 
    AnswerRe: How to save the selected icon in a file ? Pin
    Christiaan Ghijselinck8-Jun-00 15:16
    sussChristiaan Ghijselinck8-Jun-00 15:16 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    Permalink | Advertise | Privacy | Terms of Use | Mobile
    Web03 | 2.8.180111.1 | Last Updated 13 Jan 2000
    Article Copyright 2000 by Henk Devos
    Everything else Copyright © CodeProject, 1999-2018
    Layout: fixed | fluid