|
-
Oct 10th, 2000, 04:27 PM
#1
Thread Starter
New Member
I'm currently using the following code to change the wallpaper in my program. I want to have radio buttons to either tile/strech/center the wallpaper. I can't figure out how to do this and have the wallpaper update instantly; all the code I've found you have to restart the computer to set tile or center. Please help!
-
Oct 10th, 2000, 06:42 PM
#2
Fanatic Member
GWDASH
[b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]
-
Oct 10th, 2000, 08:00 PM
#3
Thread Starter
New Member
Private Const RDW_INVALIDATE = &H1
Private Const RDW_INTERNALPAINT = &H2
Private Const RDW_ERASE = &H4
Private Const RDW_VALIDATE = &H8
Private Const RDW_NOINTERNALPAINT = &H10
Private Const RDW_NOERASE = &H20
Private Const RDW_NOCHILDREN = &H40
Private Const RDW_ALLCHILDREN = &H80
Private Const RDW_UPDATENOW = &H100
Private Const RDW_ERASENOW = &H200
Private Const RDW_FRAME = &H400
Private Const RDW_NOFRAME = &H800
Private Const HKEY_CURRENT_USER = &H80000001
Private Const REG_SZ = 1
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function CreateRectRgnIndirect Lib "gdi32" _
(lpRect As RECT) As Long
Private Declare Function RedrawWindow Lib "user32" _
(ByVal hwnd As Long, lprcUpdate As RECT, ByVal hrgnUpdate _
As Long, ByVal fuRedraw As Long) As Long
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long
Const SPI_SETDESKWALLPAPER = 20
Const SPIF_UPDATEINIFILE = &H1
Const Picpath = "c:\winnt\"
Private Sub chkAutoPreview_Click()
If chkAutoPreview.Value = 0 Then
cmdPreviewWallpaper.Enabled = True
Else
cmdPreviewWallpaper.Enabled = False
End If
End Sub
Private Sub cmdChangeWallpaper_Click()
SystemParametersInfo SPI_SETDESKWALLPAPER, 0, (Picpath & List1.Text), SPIF_UPDATEINIFILE
Dim udtScrDim As RECT
Dim lReturn As Long
Dim hRegion As Long
udtScrDim.Left = 0
udtScrDim.Top = 0
udtScrDim.Right = Screen.Width
udtScrDim.Bottom = Screen.Height
hRegion = CreateRectRgnIndirect(udtScrDim)
If hRegion <> 0 Then
lReturn = RedrawWindow(0, udtScrDim, hRegion, _
RDW_ERASE Or RDW_FRAME Or RDW_INVALIDATE Or RDW_UPDATENOW Or RDW_INTERNALPAINT Or RDW_ALLCHILDREN)
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|