• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

displayed view icon does not change with file association change...

When I first implemented the code attached, it worked perfectly, and my default image editor icon (Paint Shop Pro)'s icon was displayed just as I wanted.   However, as a test I changed the file associations so gif files will be edited with Paint, but no matter what I do, even to the point of rebooting the computer, the icon for Paint Shop Pro is still the one displayed.

What am I missing?


Public Function SetEditorIcon(ByRef lex As LastException) As Boolean
        Dim ls_dir As String = Nothing
        Dim fsavedfilename As String
        Dim editoricon As System.Drawing.Icon
        Dim retval As Boolean = True

        Try

        
            fsavedfilename = System.Configuration.ConfigurationManager.AppSettings("UserFormPageDirectory") & "temp.gif"
            If System.IO.File.Exists(fsavedfilename) Then
                System.IO.File.Delete(fsavedfilename)
                Application.DoEvents()
            End If
            If Not System.IO.File.Exists(fsavedfilename) Then
                System.IO.File.Create(fsavedfilename)
                Application.DoEvents()
            End If

            editoricon = System.Drawing.Icon.ExtractAssociatedIcon(fsavedfilename)

            frm.ToolStripButtonEdit.Image = Nothing

            frm.ToolStripButtonEdit.Image = editoricon.ToBitmap

        Catch ex As Exception

            retval = False
            lex.Message = ex.Message
            If Not ex.InnerException Is Nothing Then
                lex.Detail = ex.InnerException.Message
            End If
            lex.Source = "FormManagerCtrl - SetEditorIcon"
            lex.Code = "System Exception"


        End Try


        Return retval

    End Function

Open in new window

0
codefinger
Asked:
codefinger
  • 2
  • 2
1 Solution
 
codefingerAuthor Commented:
Hmmmm....I am not sure if I completely changed the the file associations.  Viewed in Windows Explorer, my temporary gif file still says it is a Paint Shop Pro Image, so maybe the problem is not entirely in the code.

0
 
CodeCruiserCommented:
Try the paint shop pro settings to dis-associate it from GIF files and try again.
0
 
codefingerAuthor Commented:
He shoots,  he scores!   Thanks!
0
 
CodeCruiserCommented:
Glad to help :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now