Small Basic #6: Odds and Ends - Desktop, Dictionary, Flickr, ImageList, and Network
Some Microsoft Small Basic classes have very few methods and properties. Among them are:
- The Desktop class, which allows you to interact with a computer's desktop.
- The Dictionary class, which allows you to fetch definitions of words over the Internet.
- The Flickr class, which allows you to fetch pictures from Flickr over the Internet.
- The ImageList class, which allows you to fetch images on a computer or over the Internet.
- The Network class, which allows you to fetch files on a computer or over the Internet.
' Desktop class.
TextWindow.WriteLine("The desktop size is " + Desktop.Width + "x" + Desktop.Height + ".")
Desktop.SetWallPaper("C:\Windows\Web\Wallpaper\Windows\img0.jpg")
' Dictionary class.
TextWindow.WriteLine(Dictionary.GetDefinition("banana"))
TextWindow.WriteLine(Dictionary.GetDefinitionInFrench("banana"))
' Flickr class.
GraphicsWindow.Show()
' Note that Flickr methods have the potential to display images that may not be suitable for younger users.
GraphicsWindow.DrawImage(Flickr.GetPictureOfMoment(), 0, 0)
Program.Delay(5000)
GraphicsWindow.Clear()
GraphicsWindow.DrawImage( Flickr.GetRandomPicture("cat"), 0, 0)
' Image class.
URL = Flickr.GetRandomPicture("cat")
' Note that the LoadImage method has the potential to display images that may not be suitable for younger users.
GraphicsWindow.DrawImage(ImageList.LoadImage(URL), 0, 0)
GraphicsWindow.Width = ImageList.GetWidthOfImage(URL)
GraphicsWindow.Height = ImageList.GetHeightOfImage(URL)
' Network class.
' Note that Network methods have the potential to display content that may not be suitable for younger users.
TextWindow.WriteLine("Downloaded a file to: " + Network.DownloadFile("https://msdn.microsoft.com/en-us/default.aspx"))
GraphicsWindow.DrawBoundText(0, 0, GraphicsWindow.Width, Network.GetWebPageContents("https://msdn.microsoft.com/en-us/default.aspx"))
Comments
Anonymous
May 20, 2014
I know this is an old - but helpful post - do you know why the definition class does not seem to be working in SmallBasic?Anonymous
March 06, 2016
Hello! If anyone has any questions, please ask in the Small Basic forum: social.msdn.microsoft.com/.../threads Thanks!