Results 1 to 21 of 21

Thread: Change wallpaper Vista - VB 6

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    Iran
    Posts
    237

    Change wallpaper Vista - VB 6

    Hi,
    How can i change wallpaper in vista using VB 6?
    Very thanks.
    Y.P.Y

  2. #2
    Addicted Member
    Join Date
    Jun 2006
    Location
    Egypt
    Posts
    162

    Re: Change wallpaper Vista - VB 6

    Do you mean that you used the regular code which we use in previous windows versions and it failed with vista ?

    Edit : Anyway here is the code :
    vb Code:
    1. 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
    2. Const SPI_SETDESKWALLPAPER = 20
    3. Const SPIF_UPDATEINIFILE = &H1
    4.  
    5.  
    6. Private Sub cmdSetWallpaper_Click()
    7. SystemParametersInfo SPI_SETDESKWALLPAPER, 0, "C:\image.bmp", SPIF_UPDATEINIFILE
    8. End Sub

    I suppose it works only with bitmaps
    Last edited by msayed2004; Mar 4th, 2007 at 02:19 PM.
    Mohammed Sayed - Egypt - Anesthetist



    =

    =

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    Iran
    Posts
    237

    Re: Change wallpaper Vista - VB 6

    Ok, very thanks msayed2004. How can i rate you? place the link if possible. Tnx again.
    Y.P.Y

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Change wallpaper Vista - VB 6

    It's the icon of the scales at the bottom-left of his post (next to the red triangle).

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    Iran
    Posts
    237

    Re: Change wallpaper Vista - VB 6

    Tnx. Now how can i set position(Center, strech...) on this application(VB)? Very very thanks.
    Y.P.Y

  6. #6
    Addicted Member
    Join Date
    Jun 2006
    Location
    Egypt
    Posts
    162

    Smile Re: Change wallpaper Vista - VB 6

    Not 100% sure about its accuracy but try to update some registry values before my code :

    Key : HKEY_CURRENT_USER\Control Panel\Desktop

    Values :
    -Tilewallpaper
    -Wallpaperstyle


    For a center-ed wallpaper :
    Set Tilewallpaper to : 0
    Set Wallpaperstyle to : 0

    For a stretch-ed wallpaper :
    Set Tilewallpaper to : 0
    Set Wallpaperstyle to : 2

    For a tile-ed wallpaper :
    Set Tilewallpaper to : 1
    Set Wallpaperstyle to : 0

    Now try the SystemParametersInfo API as before.

    Please tell me if it worked , I am busy now so I can not test it by myself.

    Regards.
    Mohammed Sayed - Egypt - Anesthetist



    =

    =

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    Iran
    Posts
    237

    Smile Re: Change wallpaper Vista - VB 6

    Can you add position setting in my project?
    Plz check attached file. Very thanks.
    Attached Files Attached Files
    Y.P.Y

  8. #8
    Addicted Member
    Join Date
    Jun 2006
    Location
    Egypt
    Posts
    162

    Re: Change wallpaper Vista - VB 6

    OK , use the attached module , it will do the task
    Attached Files Attached Files
    Mohammed Sayed - Egypt - Anesthetist



    =

    =

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    Iran
    Posts
    237

    Re: Change wallpaper Vista - VB 6

    Very thanks Mr Mohammad. I need you for some projects. Do you have PayPal account? Tnx.
    Y.P.Y

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    Iran
    Posts
    237

    Re: Change wallpaper Vista - VB 6

    Y.P.Y

  11. #11
    Addicted Member
    Join Date
    Jun 2006
    Location
    Egypt
    Posts
    162

    Re: Change wallpaper Vista - VB 6

    Quote Originally Posted by Yoosha
    Very thanks Mr Mohammad. I need you for some projects. Do you have PayPal account? Tnx.
    You are welcome , I don't have a paypal account , why ?

    You don't think about renting me , I don't work as a developer I study medicine , developing is just a hobby.

    But you can get free help here and at other vb forums.

    Btw : Mark this thread as Resolved if my module work with you on vista.
    Mohammed Sayed - Egypt - Anesthetist



    =

    =

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    Iran
    Posts
    237

    Re: Change wallpaper Vista - VB 6

    Ok, Mr Mohammad. Do you can create application to set the master sound volume and mute on Windows Vista?
    Thanks again.
    Y.P.Y

  13. #13
    Addicted Member
    Join Date
    Jun 2006
    Location
    Egypt
    Posts
    162

    Re: Change wallpaper Vista - VB 6

    Try the attached project , I don't have vista so you must try it by yourself.

    Note : For each different question make a new thread (after searching) to make it easy for other ppl to search & easy for search engines to index the place.

    Edit : this project made by the KPD team : http://allapi.mentalis.org/
    Attached Files Attached Files
    Mohammed Sayed - Egypt - Anesthetist



    =

    =

  14. #14
    New Member
    Join Date
    Mar 2007
    Posts
    6

    Re: Change wallpaper Vista - VB 6

    mr yoosha i think that u r from usa, msayed2004 isn' asking for money
    i'm a new member here & i'm glad to be right here, i'm from egypt too
    and ................
    it's enough today
    good bye
    Last edited by creatingsolutions; Mar 5th, 2007 at 05:32 PM.

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    Iran
    Posts
    237

    Re: Change wallpaper Vista - VB 6

    Hi,
    I'm not shure what to modify. I only need a single .BAS module, without the user needing to install anything. Using the common dialog from COGDLG32.OCX is not an option because not all Windows systems have this installed by default. Can you please modify the module to allow it to accept a filename.

    Example;
    Public Function SetWallpaper(ImagePath As String, FileName As String, Position As String) As Boolean

    Thanks

    Kind regards,
    Heraut

    P.S.
    Second, why do you only allow BMP wallpapers? Vista uses JPG, GIF, PNG, etc.
    Y.P.Y

  16. #16
    Addicted Member
    Join Date
    Jun 2006
    Location
    Egypt
    Posts
    162

    Cool Re: Change wallpaper Vista - VB 6

    As I said in my PM , no need to change that module just pass the FULL path of the image to that module eg :
    vb Code:
    1. SetWallpaper "c:\img.bmp", Center

    About the BMP issue as I said before I don't have windows vista so I don't know much about it , in older versions of windows this code will mainly work with BMP only so I restricted other types.

    Edit : I attached an example that does not use the common dialog ocx , just APIs.
    Attached Files Attached Files
    Last edited by msayed2004; Mar 6th, 2007 at 12:55 PM. Reason: Adding an example
    Mohammed Sayed - Egypt - Anesthetist



    =

    =

  17. #17

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    Iran
    Posts
    237

    Re: Change wallpaper Vista - VB 6

    Quote Originally Posted by msayed2004
    Try the attached project , I don't have vista so you must try it by yourself.

    Note : For each different question make a new thread (after searching) to make it easy for other ppl to search & easy for search engines to index the place.

    Edit : this project made by the KPD team : http://allapi.mentalis.org/
    Ok, Plz see this picture:
    Attached Files Attached Files
    Y.P.Y

  18. #18
    Addicted Member
    Join Date
    Jun 2006
    Location
    Egypt
    Posts
    162

    Re: Change wallpaper Vista - VB 6

    Strange , vista added your project as an item in the Volume mixer , I am not sure if I can think about something I have no idea about so I suggest that you make a web search or wait until another vista user try it.

    Sorry for this
    Mohammed Sayed - Egypt - Anesthetist



    =

    =

  19. #19

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    Iran
    Posts
    237

    Re: Change wallpaper Vista - VB 6

    Ok, Thanks. But about wallpaper i need a function like the one below:

    Function SetWallpaper(ImagePath As String, FileName As String, Position As String) As Boolean

    ? Tnx.
    Y.P.Y

  20. #20
    Addicted Member
    Join Date
    Jun 2006
    Location
    Egypt
    Posts
    162

    Re: Change wallpaper Vista - VB 6

    Why ?
    Mohammed Sayed - Egypt - Anesthetist



    =

    =

  21. #21

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Location
    Iran
    Posts
    237

    Re: Change wallpaper Vista - VB 6

    I need code of function that allows me to switch the wallpaper in Vista. thanks.
    Y.P.Y

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