TechnoTone
Junior Contributor
I'm having trouble getting the SetSysColors API function to work using VB.NET. Here is my code:
Whatever I try, I always get a return value of zero and the desktop color doesn't change.
Visual Basic:
Private Declare Function SetSysColors Lib "user32" Alias "SetSysColors" (ByVal nChanges As Integer, ByVal lpSysColor As Integer, ByVal lpColorValues As Integer) As Integer
Private Const COLOR_DESKTOP As Integer = 1
Private Sub cmdGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGo.Click
Dim x As Integer = COLOR_DESKTOP
Dim y As Integer = Color.Red.ToArgb
MessageBox.Show(SetSysColors(1, x, y).ToString)
End Sub
Whatever I try, I always get a return value of zero and the desktop color doesn't change.