VBcoders Guest

Don't have an account yet? Register

Forgot Password?

Daily Dilbert

by Bjorn Larsson (1 Submission)
Category: Jokes/Humor
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (109 Votes)

This program Downloads the archive page from
' https://www.unitedmedia.com/comics/dilbert
' extracts the file name of the picture. Download it. Convert it to bitmap.
' Changes the desktop wallpaper to the new dilbert strip.

You must have an internet connection..
Code Returns
2 files on c:\ dilbert.gif and dilbert.bmp ' A changed wallpaper.
Side Effects
Sometimes the desktop wallpaper is not visible ' unless you refresh the desktop yourself ' or select it manually. I don't know why this happends...
API Declarations
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

Rate Daily Dilbert

' 1. Create a new form.
' 2. Add a Textbox,a pictureBox and an Inet control.
' 3. Let them all have their default name. 
' 4. Put all the code expect the global decleration in the "form load procedure"
 Dim Pos As Integer
 Dim Pos2 As Integer
 Dim Bilden() As Byte
 Dim NrString As String
 Text1.Text = Inet1.OpenURL ("http://www.unitedmedia.com/comics/dilbert/archive/") 'Download the page.
 Pos = InStr(1, Text1.Text, "/comics/dilbert/archive/images/dilbert")
 Pos2 = InStr(Pos, Text1.Text, ".gif")
 NrString = Mid(Text1.Text, Pos, Pos2 - Pos)
 Text1.Text = "http://www.unitedmedia.com" + NrString + ".gif" ' Debug filename
 Bilden() = Inet1.OpenURL("http://www.unitedmedia.com" + NrString + ".gif", icByteArray) ' Download picture.
 Open "C:\dilbert.gif" For Binary Access Write As #1 ' Save the file.
 Put #1, , Bilden() 
 Close #1 
 Picture1.Picture = LoadPicture("c:\dilbert.gif") 'Reload it to PictureBox
 SavePicture Picture1.Picture, "c:\dilbert.bmp"  'Converted to bmp.. 
 Call SystemParametersInfo(20, 0, "c:\dilbert.bmp", 1) 'Change the wallpaper.
 Unload Me ' Exit program

Download this snippet    Add to My Saved Code

Daily Dilbert Comments

No comments have been posted about Daily Dilbert. Why not be the first to post a comment about Daily Dilbert.

Post your comment

0/1000 characters