刷新桌面 - VB.NET

时间:2014-10-18 16:04:23

标签: vb.net

我试图刷新桌面,试过这个,

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)

但它给了我错误

enter image description here

刷新桌面的正确方法是什么?

1 个答案:

答案 0 :(得分:0)

您需要在方法中调用 SHCangeNotify(& H8000000,& H0,Nothing,Nothing),例如:

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