Oppure

Loading
20/06/09 17:51
LoganShile
Vorrei cambiare dopo un tot di tempo, lo sfondo del desktop con dei wallpaper che si trovano in una determinata cartella. Il percorso della cartella non deve essere cambiato successivamente, quindi può essere anche impostato nel codice senza cambiarlo successivamente. Come posso fare ?
aaa
20/06/09 18:10
manvb.net
lmgtfy.com/

Per tenere conto del tempo puoi usare un timer (lo imposti a 60 secondi e a ogni tick aumenti una variabile minuti).

Per quanto riguarda i wallpaper ne puoi ottenere una list con:

My.Computer.FileSystem.GetFiles(directory)
Ultima modifica effettuata da manvb.net 20/06/09 18:16
aaa
20/06/09 18:34
LoganShile
Ho messo:
_______________________________________________________________________________________________________
Public Class Form1
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Random, ByVal fuWinIni As Long) As Long
Private Const SPI_SETDESKWALLPAPER = 20
Private Const SPIF_UPDATEINIFILE = &H1
Private Const NOMESFONDO = "C:\Windows\Web\Wallpaper\img9.jpg"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim PATHSFONDO As String
PATHSFONDO = App.Path & "C:\Windows\Web\Wallpaper\img9.jpg"
End Sub
End Class
_______________________________________________________________________________________________________
Ma mi da errore:
Nome App non dichiarato...
aaa
20/06/09 18:48
Jeremy
Postato originariamente da LoganShile:
Ma mi da errore:
Nome App non dichiarato...


AppPath(senza punto) ... se non ricordo male, si usava in Vb6 per ottenere il percorso dell'applicazione .... sosituiscilo con:
My.Application.Info.DirectoryPath


Facci sapere...
Ciao


EDIT:
Ad ogni modo questa riga:
  PATHSFONDO = App.Path & "C:\Windows\Web\Wallpaper\img9.jpg" 

non ha senso .... sostituiscila con il percorso in cui si trovano le immagini di sfondo.
Ultima modifica effettuata da Jeremy 20/06/09 18:51
aaa
20/06/09 18:52
LoganShile
OK non mi da errori ma non funziona...Leggi attentamente il codice:

Public Class Form1
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Random, ByVal fuWinIni As Long) As Long
Private Const SPI_SETDESKWALLPAPER = 20
Private Const SPIF_UPDATEINIFILE = &H1
Private Const NOMESFONDO = "C:\Windows\Web\Wallpaper\img9.jpg"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim PATHSFONDO As String
PATHSFONDO = My.Application.Info.DirectoryPath & "C:\Windows\Web\Wallpaper\img9.jpg"
End Sub
End Class
aaa
20/06/09 18:54
manvb.net
Scusa che senso ha questa riga:

PATHSFONDO = AppPath & "C:\Windows\Web\Wallpaper\img9.jpg"

:-?:-?:-?

Non può uscire un percorso valido.
Ultima modifica effettuata da manvb.net 20/06/09 18:55
aaa
20/06/09 18:54
Jeremy
Ho modificato il post di prima .... dagli un ochhio.
Ciao
aaa
20/06/09 18:59
LoganShile
Jeremy, se sostituisco diventa così:
Public Class Form1
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Random, ByVal fuWinIni As Long) As Long
Private Const SPI_SETDESKWALLPAPER = 20
Private Const SPIF_UPDATEINIFILE = &H1
Private Const NOMESFONDO = "C:\Windows\Web\Wallpaper\img9.jpg"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim PATHSFONDO As String
PATHSFONDO = "C:\Windows\Web\Wallpaper\"
End Sub
End Class


E non và lo stesso
aaa