home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Messages_i3790011272001.psc / frmMessage.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-11-28  |  3.6 KB  |  95 lines

  1. VERSION 5.00
  2. Begin VB.Form frmMessage 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Write X-Files Type of Message"
  5.    ClientHeight    =   3975
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   6915
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    ScaleHeight     =   3975
  12.    ScaleWidth      =   6915
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.Timer tmrNewText 
  15.       Interval        =   200
  16.       Left            =   2160
  17.       Top             =   1740
  18.    End
  19.    Begin VB.PictureBox picMessage 
  20.       Appearance      =   0  'Flat
  21.       BackColor       =   &H00000000&
  22.       BeginProperty Font 
  23.          Name            =   "Courier New"
  24.          Size            =   12
  25.          Charset         =   0
  26.          Weight          =   400
  27.          Underline       =   0   'False
  28.          Italic          =   0   'False
  29.          Strikethrough   =   0   'False
  30.       EndProperty
  31.       ForeColor       =   &H0000FF00&
  32.       Height          =   3975
  33.       Left            =   0
  34.       ScaleHeight     =   3945
  35.       ScaleWidth      =   6885
  36.       TabIndex        =   0
  37.       Top             =   0
  38.       Width           =   6915
  39.    End
  40. Attribute VB_Name = "frmMessage"
  41. Attribute VB_GlobalNameSpace = False
  42. Attribute VB_Creatable = False
  43. Attribute VB_PredeclaredId = True
  44. Attribute VB_Exposed = False
  45. Option Explicit ' Now I must declare variables (you really should (must) use this!)
  46.   ' Declare message-stuff
  47. Private strMessage As String    ' Define this in Form_Load (otherwise you can make a const, but then you won't be able to change it....)
  48. Private lngLetterCount As Long  ' Will keep track of which letter we're on
  49. Dim AppPath As String ' See in Form_Load
  50. Const NL = vbCrLf ' Makes it faster/easier to write NewLines
  51. Private Sub Form_Load()
  52.     ' The real way to use App.Path
  53.   AppPath = App.Path
  54.   If Right(AppPath, 1) <> "\" Then _
  55.     AppPath = AppPath & "\"
  56.     ' Define the message
  57.   strMessage = "Welcome to this demo!" & NL & _
  58.                 "Use this to make cool text-effects..." & NL & _
  59.                 "There is not much you can use this for..." & NL & _
  60.                 "I don't really know why I even did this..." & NL & _
  61.                 NL & _
  62.                 "Use as you wish," & NL & _
  63.                 "Mikael Nordfelth"
  64. End Sub
  65. Private Sub Form_Unload(Cancel As Integer)
  66.     ' If there were more forms, then this would be neccessary...
  67.   End
  68. End Sub
  69. Private Sub tmrNewText_Timer()  ' (Sounds are from ICQ... Hope it's legal...)
  70.   On Error Resume Next
  71.     ' Update message
  72.   If lngLetterCount <= Len(strMessage) Then
  73.     picMessage.Cls  ' Clear picturebox and reset CurrentX and CurrentY
  74.     picMessage.Print Mid(strMessage, 1, lngLetterCount) ' Print what we want from the message
  75.   End If
  76.     ' Play fun sounds... =)
  77.   If lngLetterCount > Len(strMessage) Then
  78.     DoEvents  ' Gives Windows a chance to work with other stuff... (must-have in loops)
  79.   ElseIf lngLetterCount = Len(strMessage) Then
  80.     PlayWav AppPath & "Done.wav"  ' Bluing-sound
  81.   Else
  82.     If Asc(Mid(strMessage, lngLetterCount, 1)) = 13 Then  ' Enter
  83.       PlayWav AppPath & "Enter.wav"
  84.     ElseIf Asc(Mid(strMessage, lngLetterCount, 1)) = 32 Then  ' Space
  85.       PlayWav AppPath & "Space.wav"
  86.     Else  ' Other
  87.       PlayWav AppPath & "Type.wav"  ' Click-sound
  88.     End If
  89.   End If
  90.     ' Otherwise we won't write the next letter
  91.   lngLetterCount = lngLetterCount + 1
  92.   ' You can also make it type multiple messages, after each other... _
  93.     but I just didn't feel like it this time...
  94. End Sub
  95.