vb2008下如何改變數登錄通知系統生效?

如下圖環境變數中增加一個"c:\test"後按""確定"在"命令提示字元"可以見到path命令立即生效,但係用程式直接改登錄
[HKEY_CURRENT_USER\Environment] "path"="c:\test\testok"後並未見到生效,試過用以下程式碼但係冇作用,環境變數都冇改過


Public Class Form1
       Private Declare Function SendMessageTimeout Lib "user32" Alias "SendMessageTimeoutA" (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As String, ByVal fuFlags As Long,   ByVal uTimeout As Long, ByVal lpdwResult As Long) As Long
    Private Const HWND_BROADCAST As Long = &HFFFF&
    Private Const SMTO_ABORTIFHUNG As Long = &H2
    Private Const WM_SETTINGCHANGE As Long = &H1A

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
           End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0&, "Environment", SMTO_ABORTIFHUNG, 5000&, 0)
          End
    End Sub
End Class
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊