Automatic wallpaper changer

       


By Dj Rush (Michael Jansson)

Platform: Visual Basic 6.0 ( visual Basic 98)
  http://djrush.cjb.net   
  http://myspace.com/djrush95 
  http://geocitiescom/djrush95  
  http://myspace.com/gameprogrammer29  
  http://geocities.com/michaeljansson95 
                                           

Download Source code : chWallpaper_src.zip







                             



Designing in the Visual basic 98 (6.0)
form designer enviroment




Designing apps in Visual basic is pretty straightforward.
Click on the desired component (control) , located at the left toolbar
of visual basic and draw it at an appropiate locaton on the form.
Componments on the form align to rectangular grids giving
your apps a symmetric look.

This app uses the following components:

- command buttons
- radio buttons
- check boxes
- horizontal scroll bars
- frames
- image controls
- list box
- timer
- labels









Altering the wallpaper change mode




Selection of how the app will change desktop wallpapers is
done here. One can either let the app automatically change
wallpapers or one can manually do so by clicking the
'set as wallpaper' button.




Private Sub optMode_Click(Index As Integer)
Select Case Index
      Case 0:      optMode(0).Value = True
      Case 1:      optMode(1).Value = True
   End Select
End Sub







If optMode(0).Value = True Then
 
    '***********************
   
    If optSeq(1).Value = True Then
    
     CurrentWallpaperFile = CurrentWallpaperFile + 1
     If (CurrentWallpaperFile > MaxWallpaperFiles) Then CurrentWallpaperFile = 0
     Frame5.Caption = " Wallpapers  ( " & MaxWallpaperFiles & "  files ) " & (MaxWallpaperFiles - 1) - CurrentWallpaperFile & "  to go "
         If (CurrentWallpaperFile > MaxWallpaperFiles - 1) Then CurrentWallpaperFile = 0
         Else
       
         'DoneFileCount = DoneFileCount + 1
         'CurrentWallpaperFile = DoneWallpaperFiles(DoneFileCount)
        
         cnt = cnt + 1
         Frame5.Caption = " Wallpapers  ( " & MaxWallpaperFiles & "  files ) " & MaxWallpaperFiles - cnt & "  to go "
         CurrentWallpaperFile = DoneWallpaperFiles(cnt)
         List1.ListIndex = CurrentWallpaperFile
         'If (DoneFileCount > MaxWallpaperFiles) Then
        
         If (cnt > MaxWallpaperFiles - 1) Then
         cnt = 0If optMode(0).Value = True Then
 
    '***********************
   
    If optSeq(1).Value = True Then
    
     CurrentWallpaperFile = CurrentWallpaperFile + 1
     If (CurrentWallpaperFile > MaxWallpaperFiles) Then CurrentWallpaperFile = 0
     Frame5.Caption = " Wallpapers  ( " & MaxWallpaperFiles & "  files ) " & (MaxWallpaperFiles - 1) - CurrentWallpaperFile & "  to go "
         If (CurrentWallpaperFile > MaxWallpaperFiles - 1) Then CurrentWallpaperFile = 0
         Else
       
         'DoneFileCount = DoneFileCount + 1
         'CurrentWallpaperFile = DoneWallpaperFiles(DoneFileCount)
        
         cnt = cnt + 1
         Frame5.Caption = " Wallpapers  ( " & MaxWallpaperFiles & "  files ) " & MaxWallpaperFiles - cnt & "  to go "
         CurrentWallpaperFile = DoneWallpaperFiles(cnt)
         List1.ListIndex = CurrentWallpaperFile
         'If (DoneFileCount > MaxWallpaperFiles) Then
        
         If (cnt > MaxWallpaperFiles - 1) Then
         cnt = 0
          ' DoneFileCount = 0
          GenerateRandomFile
                         
         End If
         
 End If
 
 '***********************
 
 ChangeWallpaper
  
 'DoneFileCount = DoneFileCount + 1
 'MsgBox DoneFileCount & ".  " & DoneWallpaperFiles(DoneFileCount) & " opps"
 
End If

          ' DoneFileCount = 0
          GenerateRandomFile
                         
         End If
         
 End If
 
 '***********************
 
 ChangeWallpaper
  
 'DoneFileCount = DoneFileCount + 1
 'MsgBox DoneFileCount & ".  " & DoneWallpaperFiles(DoneFileCount) & " opps"
 
End If







Setting the wallpaper change sequence



The sequence of the wallpapers can be randomily done or
sequenced in a foward non-random direction.
The app generates a series of random numbers, stores them
in an array. This is done to assure that numbers arent
repeated as often occurs when using the random function.





Private Sub optSeq_Click(Index As Integer)
Select Case Index
      Case 0:
                optSeq(0).Value = True
                autoMode = True
      Case 1:      optSeq(1).Value = True
                autoMode = False
   End Select
End Sub








    If optSeq(1).Value = True Then
    
     CurrentWallpaperFile = CurrentWallpaperFile + 1
     If (CurrentWallpaperFile > MaxWallpaperFiles) Then CurrentWallpaperFile = 0
     Frame5.Caption = " Wallpapers  ( " & MaxWallpaperFiles & "  files ) " & (MaxWallpaperFiles - 1) - CurrentWallpaperFile & "  to go "
         If (CurrentWallpaperFile > MaxWallpaperFiles - 1) Then CurrentWallpaperFile = 0
         Else
       
         'DoneFileCount = DoneFileCount + 1
         'CurrentWallpaperFile = DoneWallpaperFiles(DoneFileCount)
        
         cnt = cnt + 1
         Frame5.Caption = " Wallpapers  ( " & MaxWallpaperFiles & "  files ) " & MaxWallpaperFiles - cnt & "  to go "
         CurrentWallpaperFile = DoneWallpaperFiles(cnt)
         List1.ListIndex = CurrentWallpaperFile
         'If (DoneFileCount > MaxWallpaperFiles) Then
        
         If (cnt > MaxWallpaperFiles - 1) Then
         cnt = 0
          ' DoneFileCount = 0
          GenerateRandomFile
                         
         End If








Adjusting the wallpaper change time




The default time and max time is set to 30 seconds but can be
reduced down to 2 seconds using the scrollbar.




Private Sub HScroll1_Change()
    Timer1.Interval = HScroll1.Value
    Label10.Caption = " " & Timer1.Interval / 1000 & " seconds"
    WallpaperChangeInterval = HScroll1.Value
End Sub





The Program's loop




The core of this app has been placed in Timer1
to make things as simple as can be.





Private Sub Timer1_Timer()

        '********************
        '**                **
        '********************
        On Error Resume Next
       
        TimerStart = Timer
       
         'Delay = ((TimeDelay / 1000) - (TimerElap - TimerStart)) * 1000
          Delay = TimeDelay - Int(((TimerElap - TimerStart)) * 1000)
       
        '***********************
                       
        If optMode(0).Value = True Then
        
            '***********************
           
            If optSeq(1).Value = True Then
            
             CurrentWallpaperFile = CurrentWallpaperFile + 1
             If (CurrentWallpaperFile > MaxWallpaperFiles) Then CurrentWallpaperFile = 0
             Frame5.Caption = " Wallpapers  ( " & MaxWallpaperFiles & "  files ) " & (MaxWallpaperFiles - 1) - CurrentWallpaperFile & "  to go "
                 If (CurrentWallpaperFile > MaxWallpaperFiles - 1) Then CurrentWallpaperFile = 0
                 Else
               
                 'DoneFileCount = DoneFileCount + 1
                 'CurrentWallpaperFile = DoneWallpaperFiles(DoneFileCount)
                
                 cnt = cnt + 1
                 Frame5.Caption = " Wallpapers  ( " & MaxWallpaperFiles & "  files ) " & MaxWallpaperFiles - cnt & "  to go "
                 CurrentWallpaperFile = DoneWallpaperFiles(cnt)
                 List1.ListIndex = CurrentWallpaperFile
                 'If (DoneFileCount > MaxWallpaperFiles) Then
                
                 If (cnt > MaxWallpaperFiles - 1) Then
                 cnt = 0
                  ' DoneFileCount = 0
                  GenerateRandomFile
                                 
                 End If
                 
         End If
        
         '***********************
        
         ChangeWallpaper
          
         'DoneFileCount = DoneFileCount + 1
         'MsgBox DoneFileCount & ".  " & DoneWallpaperFiles(DoneFileCount) & " opps"
         
        End If
 
End Sub










when all said and done
(when the code is run)




When the app is run, this is what it will be rendered as.




Browsing for wallpapers and
selecting wallpaper folders.






Obviously this app wouldbe useless without this feature. Browsing for
folders containing wallpapers is pretty straightforward. Select the
folder containing the 'bmp files and click the ' ok ' button.
The app will list all bmp files found in the list box located to the
lower left section of the form.
Selecting the files is done by clicking the file in question,
a preview of the .bmp file will be rendered in the wapaper preview.
Clicking the ' set as wallpaper ' will set it as wallpaper or
one can click the ' automatic ' radio button to have the app
automatically set the wallpapers.



Download Source code : 
chWallpaper_src.zip






Automatic wallpaper changer

       


By Dj Rush (Michael Jansson)

Platform: Visual Basic 6.0 ( visual Basic 98)

Dj Rush links:

 
http://djrush.cjb.net
   
 
http://myspace.com/djrush95
 
 
http://geocitiescom/djrush95
  
 
http://myspace.com/gameprogrammer29
  
 
http://geocities.com/michaeljansson95
 






Hosted by www.Geocities.ws

1