Imports System.IO ' Copyright Troy Luallin and Ryan Hoagland 2003-2004 Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " #End Region Const path As String = "C:\vwindow" Const interval As Int32 = (1000 * 60 * 15) 'ms*60sec*min Dim i As Int32 = 0 Dim imageHandle As Image Dim filenames() As FileInfo Dim fullPathToFile As String Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim currentDirectory As New DirectoryInfo(path) 'Instantiate and set the current directory from the constant filenames = currentDirectory.GetFiles("*.bmp") 'Let's build a list of files of the correct type 'Cursor.Hide() 'Let's hide the cursor so that it doesn't intrude on our pleasant slide show Timer1.Interval = interval 'Set our timer from our constant above increment_picture() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick increment_picture() End Sub Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click 'Cursor.Show() 'Bring the cursor back so that you can see where to click on the msgbox 'If (MsgBox("Quit Virtual Window? Are you sure?", MsgBoxStyle.YesNo, "Important!!!") = MsgBoxResult.Yes) Then ' Close() 'End If 'Cursor.Hide() 'If we made it here, we must have clicked "no", so let's hide the mouse pointer again Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None Me.ClientSize = New System.Drawing.Size(3072, 2048) 'set to the visual resolution of the virtual window Me.Location = New System.Drawing.Point(0, -1024) Cursor.Hide() End Sub Private Sub increment_picture() 'Takes no arguments, returns no arguments 'This needs to be changed to have a Static local variable fullPathToFile = filenames(i).FullName 'Pull the full path to the file out of the list we previously built PictureBox1.Image = imageHandle.FromFile(fullPathToFile) i = (i + 1) Mod filenames.Length End Sub Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress If e.KeyChar Like " " Then Timer1.Interval = interval increment_picture() End If End Sub End Class