Logo
English Russian German French Spanish Italian
contact usprivacy
   Support Forums
chart
• Adjust flexgrid cell
• Animation
• Centering form text
• Coffee machine
• Creating fileshares
• Creating shortcuts
• Custom buttons
• Directory browser
• Disable mouse events
• File search by ext
• File transfer
• File watcher
• Formatting flexgrid
• Get Content Type
• Get HTML source
• Get modem port
• HTTP proxy
• ipconfig
• Large file split/merge
• MAPI
• MCI Sound Player
• Menu with images
• MP3 normalizer
• Net Send
• Netstat 2000
• No duplicate entries
• Outlook Address Book
• Set font color
• Shapes
• SOAP test
• Text-to-image
• Text file viewer
• Text find/replace
• UPS component
• View NT groups
• Word template
• Writing DNS control
    • Using DNS control
• Writing SMTP control
    • Sending email
    • Mailing list
• Writing WhoIs control
    • Using WhoIs control
• View HTML source
OISV - Organization of Independent Software Vendors - Contributing Member
VB projects - Coffee Machine

Description: in-depth coverage of coffee-brewing process
Minimum requirements: VB5
Download: source code
Screenshot:
Coffee Machine (6 KB)
Project: Standard EXE
Controls: fm (Frame), picProcessor (PictureBox), picOutput (PictureBox), picGlass (PictureBox), cmdDrink (CommandButton, Index = 0), cmdDrink (CommandButton, Index = 1), cmdDrink (CommandButton, Index = 2), cmdDrink (CommandButton, Index = 3), lbl (Label)
Code:
Option Explicit

Private Declare Function GetTickCount Lib "kernel32" () As Long

Private Sub cmdDrink_Click(Index As Integer)
    Dim n As Double
    Dim x As Integer: Dim y As Integer
    Dim x1 As Integer: Dim y2 As Integer
    
    EnableButtons False
    n = GetTickCount
    lbl = "Processing the drink..."
    x = fm.Left: y = fm.Top
    While GetTickCount - n < 2000
        Randomize
        fm.Left = x + Int((20 * Rnd) + 1) - 10
        Randomize
        fm.Top = y + Int((20 * Rnd) + 1) - 10
        Randomize
        picProcessor.BackColor = QBColor(Rnd * 15)
        frmMain.Refresh
        DoEvents
    Wend
    fm.Left = x: fm.Top = y
    picProcessor.BackColor = &HFF8080
    While picGlass.Top < 30
        picGlass.Top = picGlass.Top + 1
        frmMain.Refresh
        For x = 0 To 32000
        Next
    Wend
    While picGlass.Left < picOutput.Width - picGlass.Width - 30
        picGlass.Left = picGlass.Left + 1
        frmMain.Refresh
        For x = 0 To 32000
        Next
    Wend
    lbl = "Take the drink"
    n = GetTickCount
    While GetTickCount - n < 2000
        DoEvents
    Wend
    picGlass.Top = -700
    picGlass.Left = 0
    lbl = "Ready for use"
    EnableButtons True
End Sub

Private Sub Form_Terminate()
    End
End Sub

Private Sub Form_Unload(Cancel As Integer)
    End
End Sub

Private Sub EnableButtons(b As Boolean)
    cmdDrink(0).Enabled = b
    cmdDrink(1).Enabled = b
    cmdDrink(2).Enabled = b
    cmdDrink(3).Enabled = b
End Sub

Copyright © 1996-2010 OstroSoft. All rights reserved. info@ostrosoft.com