I tried to change the Local Group Policy settings (Remove computer icon on dekstop, Removes windows explorer's default context menu, etc.) using the registry. The state in Group Policy(enable/disable) does affect but the actual(removing computer icon, no context menu/right click) does not. I've found a thread here that to use SendNotifyMessage to apply that change in the registry. Found a source code from pinvoke.net and tried to use it.
Imports System.Runtime.InteropServices
Public Class Form1
Public Shared ReadOnly HWND_BROADCAST As New IntPtr(&HFFFF)
Public Const WM_SETTINGCHANGE As Integer = &H1A 'it should be &H001A
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Text = SendNotifyMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0)
End Sub
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Public Shared Function SendNotifyMessage( _
ByVal hWnd As IntPtr, _
ByVal msg As UInteger, _
ByVal wParam As UIntPtr, _
ByVal lParam As IntPtr _
) As Boolean
End Function
End Class
It returns True, but does not work. Is there any wrong in the code? Are there any alternatives? Thank you in advance for any help ^_^