CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2002
    Location
    India
    Posts
    16

    Unhappy Display of iconsor embedding icons

    When we select some of the files such iexplore.exe in the change ico option in the folder option. It displays list of icons but my application display only one icon. Is it possible to embedd the necessary icons, so that my application to displays the list of icons to select with
    Last edited by Vetri Selvan; December 24th, 2002 at 05:53 AM.
    Vetri

  2. #2
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210
    I think you are talking about the ChangeIconDialog API. Here is a sample. The Sample needs a command button an label and a textbox
    Code:
    Option Explicit
    Private Declare Function SHChangeIconDialog Lib "shell32" Alias "#62" (ByVal _
      hOwner As Long, ByVal szFilename As String, ByVal Reserved As _
      Long, lpIconIndex As Long) As Long
    Function IconBrowser(ByRef sFile As String, ByVal nIndex As Long) _
      As Long
      If SHChangeIconDialog(Me.hWnd, sFile, 0, nIndex) Then
        IconBrowser = nIndex
      Else
        IconBrowser = -1
      End If
    End Function
    
    Private Sub Command1_Click()
      Label1.Caption = IconBrowser(Text1.Text, 10)
    End Sub
    
    Private Sub Form_Load()
    Text1.Text = "C:\Windows\System\Shell32.dll"
    End Sub

  3. #3
    Join Date
    Mar 2002
    Location
    India
    Posts
    16
    hai john,
    Thanks for the reply. I think i have not made my point clear. I need the multiple icon,i.e If i were to associate my program to a file then i set association of file type in the folder option there i set the association to my file, there i select the icon for the file, if i select some other program such as iexplore they have list of icons to select where as my application only one icon to select icon that to i have added to my form. Is there any of setting my application so that i shows list of icon.

    for example u have given the icon diaplog in which if u select mspaint.exe it shows me list of icons in the same way if i choose my applicatio it must also list me several icon. I thing its clear now.
    Vetri

  4. #4
    Join Date
    Dec 2002
    Location
    dubai
    Posts
    11
    hai,

    it is very simple. u need to attach a resource file with the project. in that u can add all ur required icons. when u create exe this also will go along with it. so when u create short cut , when u click the change icon option it displays all the icons listed in the resource file.

    to add resouce file do add it through add-in manager.


    try it out

    m.mohan kumar

  5. #5
    Join Date
    Mar 2002
    Location
    India
    Posts
    16

    Smile

    hai,
    Thank you for the reply u posted, that was i expeced and it really much helpful to me.

    Vetri
    Vetri

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured