Desktop icons per Code aktualisieren

  • VB.NET
  • .NET (FX) 4.5–4.8

Es gibt 2 Antworten in diesem Thema. Der letzte Beitrag () ist von Mokki.

    Desktop icons per Code aktualisieren

    Hallo,
    ich mal wieder. Ich ändere zb die Verknüfungspeile in der Reistry. Nun sollen die Desktop Icons per Code aktuallisiert werden.

    Den Explorer nöchte ich dazu nicht killen.

    Bisher habe ich es mit dem hier versucht.

    VB.NET-Quellcode

    1. Private Declare Sub SHChangeNotify Lib "shell32.dll" (ByVal wEventId As Integer, ByVal uFlags As Integer, ByVal dwItem1 As Integer, ByVal dwItem2 As Integer)
    2. SHChangeNotify(&H8000, &H1000, 0, 0)


    und auch den Iconcache aktualisieren.

    VB.NET-Quellcode

    1. Try
    2. Dim startInfo As New Process
    3. startInfo.StartInfo.FileName = "cmd"
    4. startInfo.StartInfo.Arguments = "/c ie4uinit -show"
    5. startInfo.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
    6. startInfo.StartInfo.CreateNoWindow = True
    7. startInfo.Start()
    8. Catch
    9. End Try


    Doch nichts funktioniert wirklich.

    Hat von euch jemand eine Idee wie ich das lösen könnte.

    Grüße Tooli
    Quick&Dirty: Auf dem Desktop mit der Klasse SendKeys aus dem Namespace System.Windows.Forms F5 simulieren.

    Dazu dir Pointer/Handle des Desktops holen und Focus setzen. Anschließend SendKeys.Send({F5]) aufrufen.
    In general (across programming languages), a pointer is a number that represents a physical location in memory. A nullpointer is (almost always) one that points to 0, and is widely recognized as "not pointing to anything". Since systems have different amounts of supported memory, it doesn't always take the same number of bytes to hold that number, so we call a "native size integer" one that can hold a pointer on any particular system. - Sam Harwell