Results 1 to 3 of 3

Thread: Setting Background

  1. #1

    Thread Starter
    Lively Member Optic's Avatar
    Join Date
    Mar 2001
    Location
    I'm everywhere and nowhere, I'm inside your computer and inside your mind. You can't escape me for I am vision.
    Posts
    117
    I need the api for setting the windows background to the image found in an image box. I am running windows 98. Any help would be appreciated.

  2. #2
    Megatron
    Guest
    It's found in the registry in the folloying path:
    Code:
    HKEY_CURRENT_USER\Control Panal\Desktop\WallPaper

  3. #3
    Megatron
    Guest
    Add to a Module.
    Code:
    Declare Function RegCloseKey Lib "advapi32.dll" (ByVal HKEY As Long) As Long
    Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal HKEY As Long, ByVal lpSubKey As String, phkResult As Long) As Long
    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
    Public Const HKEY_CURRENT_USER = &H80000001
    
    Public Sub SaveSettingEx(HKEY As Long, sPath As String, sValue As String, sData As String)
        Dim KeyHand As Long
        Call RegCreateKey(HKEY, sPath, KeyHand)
        Call RegSetValueEx(KeyHand&, sValue, 0, REG_SZ, ByVal sData, Len(sData))
        Call RegCloseKey(KeyHand&)
    End Sub
    Usage:
    Code:
    'Excute this to change wall paper.
    SaveSettingEx HKEY_CURRENT_USER, "Control Panal\Desktop", "Wallpaper", "C:\MyFile.bmp"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width