user198989
user198989

Reputation: 4665

Refresh desktop - VB.NET

I'm trying to refresh desktop, tried this,

Private Declare Function SHChangeNotify Lib "Shell32.dll" (ByVal wEventID As Long,
ByVal uFlags As Long, ByVal dwItem1 As Long, ByVal dwItem2 As Long) As Long

call SHChangeNotify(&H8000000&, &H0, vbNullString, vbNullString)

But it gives me error

enter image description here

What is the correct way to refresh desktop ?

Upvotes: 0

Views: 1375

Answers (1)

ganjeii
ganjeii

Reputation: 1178

You need to call SHCangeNotify(&H8000000, &H0, Nothing, Nothing) from within a method for example:

Public Class example

    Private Declare Function SHChangeNotify Lib "Shell32.dll" (ByVal wEventID As Long, _
                                                               ByVal uFlags As Long, _
                                                               ByVal dwitem1 As Long, _
                                                               ByVal deitem2 As Long) As Long

    Private Sub refreshWindow()

    SHCangeNotify(SHChangeNotify(&H8000000, &H0, Nothing, Nothing)

    End Sub

End Class

Upvotes: 1

Related Questions