home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / cafead1a / cafe.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-10-06  |  10.3 KB  |  313 lines

  1. VERSION 4.00
  2. Begin VB.Form Cafe 
  3.    BackColor       =   &H00000000&
  4.    BorderStyle     =   0  'None
  5.    ClientHeight    =   6945
  6.    ClientLeft      =   0
  7.    ClientTop       =   375
  8.    ClientWidth     =   9660
  9.    ClipControls    =   0   'False
  10.    ControlBox      =   0   'False
  11.    Height          =   7380
  12.    Icon            =   "Cafe.frx":0000
  13.    Left            =   -60
  14.    LinkTopic       =   "Cafe"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   9200
  18.    ScaleMode       =   0  'User
  19.    ScaleWidth      =   9660
  20.    ShowInTaskbar   =   0   'False
  21.    Top             =   0
  22.    Width           =   9780
  23.    WindowState     =   2  'Maximized
  24.    Begin VB.Timer Timer2 
  25.       Enabled         =   0   'False
  26.       Interval        =   1000
  27.       Left            =   7110
  28.       Top             =   4305
  29.    End
  30.    Begin VB.TextBox txtTime 
  31.       Height          =   360
  32.       Left            =   5265
  33.       Locked          =   -1  'True
  34.       TabIndex        =   7
  35.       Top             =   3120
  36.       Visible         =   0   'False
  37.       Width           =   1815
  38.    End
  39.    Begin VB.Timer Timer1 
  40.       Enabled         =   0   'False
  41.       Interval        =   60000
  42.       Left            =   6315
  43.       Top             =   4290
  44.    End
  45.    Begin VB.CommandButton cmdLogOn 
  46.       Caption         =   "Log On"
  47.       Height          =   360
  48.       Left            =   2670
  49.       TabIndex        =   6
  50.       Top             =   3120
  51.       Visible         =   0   'False
  52.       Width           =   915
  53.    End
  54.    Begin VB.TextBox txtPass 
  55.       Height          =   360
  56.       Left            =   3975
  57.       PasswordChar    =   "*"
  58.       TabIndex        =   5
  59.       Top             =   3120
  60.       Width           =   1020
  61.    End
  62.    Begin VB.Label Label6 
  63.       Alignment       =   2  'Center
  64.       BackStyle       =   0  'Transparent
  65.       Caption         =   "Click Here To Log Off"
  66.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  67.          Name            =   "Nuptial BT"
  68.          Size            =   14.25
  69.          Charset         =   0
  70.          Weight          =   700
  71.          Underline       =   0   'False
  72.          Italic          =   0   'False
  73.          Strikethrough   =   0   'False
  74.       EndProperty
  75.       ForeColor       =   &H000000FF&
  76.       Height          =   375
  77.       Left            =   3075
  78.       TabIndex        =   8
  79.       Top             =   5580
  80.       Visible         =   0   'False
  81.       Width           =   3315
  82.    End
  83.    Begin VB.Label Label5 
  84.       Alignment       =   2  'Center
  85.       BackStyle       =   0  'Transparent
  86.       Caption         =   "            Or Click Here To             Play Games Offline"
  87.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  88.          Name            =   "Nuptial BT"
  89.          Size            =   14.25
  90.          Charset         =   0
  91.          Weight          =   700
  92.          Underline       =   0   'False
  93.          Italic          =   0   'False
  94.          Strikethrough   =   0   'False
  95.       EndProperty
  96.       ForeColor       =   &H0000C000&
  97.       Height          =   615
  98.       Left            =   2970
  99.       TabIndex        =   4
  100.       Top             =   4560
  101.       Visible         =   0   'False
  102.       Width           =   3225
  103.    End
  104.    Begin VB.Label Label4 
  105.       Alignment       =   2  'Center
  106.       BackStyle       =   0  'Transparent
  107.       Caption         =   "     Password Correct      Click Here To Connect"
  108.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  109.          Name            =   "Nuptial BT"
  110.          Size            =   15.75
  111.          Charset         =   0
  112.          Weight          =   700
  113.          Underline       =   0   'False
  114.          Italic          =   0   'False
  115.          Strikethrough   =   0   'False
  116.       EndProperty
  117.       ForeColor       =   &H0000C000&
  118.       Height          =   780
  119.       Left            =   2970
  120.       TabIndex        =   3
  121.       Top             =   3630
  122.       Visible         =   0   'False
  123.       Width           =   3300
  124.    End
  125.    Begin VB.Label Label3 
  126.       Alignment       =   2  'Center
  127.       BackStyle       =   0  'Transparent
  128.       Caption         =   "To Connect To The Internet  Enter  Your Password"
  129.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  130.          Name            =   "MS Sans Serif"
  131.          Size            =   24
  132.          Charset         =   0
  133.          Weight          =   700
  134.          Underline       =   0   'False
  135.          Italic          =   0   'False
  136.          Strikethrough   =   0   'False
  137.       EndProperty
  138.       ForeColor       =   &H000000FF&
  139.       Height          =   1155
  140.       Left            =   1110
  141.       TabIndex        =   2
  142.       Top             =   1920
  143.       Width           =   7305
  144.    End
  145.    Begin VB.Label Label2 
  146.       Alignment       =   2  'Center
  147.       BackStyle       =   0  'Transparent
  148.       Caption         =   "Welcome To"
  149.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  150.          Name            =   "Nuptial BT"
  151.          Size            =   36
  152.          Charset         =   0
  153.          Weight          =   700
  154.          Underline       =   0   'False
  155.          Italic          =   0   'False
  156.          Strikethrough   =   0   'False
  157.       EndProperty
  158.       ForeColor       =   &H00FFC0FF&
  159.       Height          =   810
  160.       Left            =   2145
  161.       TabIndex        =   1
  162.       Top             =   75
  163.       Width           =   4860
  164.    End
  165.    Begin VB.Label Label1 
  166.       Alignment       =   2  'Center
  167.       Appearance      =   0  'Flat
  168.       BackColor       =   &H80000005&
  169.       BackStyle       =   0  'Transparent
  170.       Caption         =   "Internet Cafe"
  171.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  172.          Name            =   "Nuptial BT"
  173.          Size            =   72
  174.          Charset         =   0
  175.          Weight          =   700
  176.          Underline       =   0   'False
  177.          Italic          =   -1  'True
  178.          Strikethrough   =   0   'False
  179.       EndProperty
  180.       ForeColor       =   &H00FFFFFF&
  181.       Height          =   1560
  182.       Left            =   465
  183.       TabIndex        =   0
  184.       Top             =   465
  185.       Width           =   8190
  186.    End
  187. Attribute VB_Name = "Cafe"
  188. Attribute VB_Creatable = False
  189. Attribute VB_Exposed = False
  190. Option Explicit
  191. Private Sub cmdLogOn_Click()
  192. Dim strResult As String * 60 'no variable length strings allowed
  193. Dim lngResult As Long
  194. Dim strFileName As String
  195. strFileName = App.Path & "\Passwords.ini"
  196. On Error GoTo Err
  197. If txtPass.Text = "" Then Exit Sub 'must type something
  198. lngResult = GetPrivateProfileString("Passwords", _
  199. txtPass.Text, strFileName, strResult, Len(strResult), _
  200. strFileName)
  201. txtTime.Text = Trim(strResult)
  202. If Len(txtTime.Text) > 3 Then '999 minute limit
  203. 'a longer return string means there was no entry and
  204. 'a filename was returned
  205. MsgBox "Password is invalid."
  206. txtPass.Text = "" 'reset
  207. txtPass.SetFocus 'get cursor back to textbox
  208. cmdLogOn.Visible = False
  209. ElseIf txtTime.Text = "0" Then
  210. MsgBox "Time has expired on this password."
  211. txtPass.Text = ""
  212. txtPass.SetFocus
  213. MsgBox "Remember to Log Off when finished or your time will continue. Please close all programs before you Log Off or time expires."
  214. Timer2.Enabled = False 'turn everything on for user
  215. cmdLogOn.Visible = False
  216. Label4.Visible = True
  217. Label5.Visible = True
  218. Label6.Visible = True
  219. Timer1.Enabled = True
  220. txtTime.Visible = True
  221. txtPass.Visible = False
  222. txtTime.Text = txtTime.Text & "  minutes remaining."
  223. End If
  224. Exit Sub
  225. MsgBox "Error"
  226. End Sub
  227. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  228. KeyLog KeyCode, Shift 'this is for the admin password only
  229. End Sub
  230. Private Sub Form_Load()
  231. AdjustForm Me
  232. DisableKeys True 'comment out for safety
  233. TaskBar False
  234. End Sub
  235. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  236. Cancel = True
  237. End Sub
  238. Private Sub Form_Resize()
  239. FormResize Me
  240. End Sub
  241. Private Sub Form_Unload(Cancel As Integer)
  242. DisableKeys False
  243. End Sub
  244. Private Sub Label4_Click() 'click here to connect
  245. Run Me, "C:\Program Files\Netscape\Communicator\Program\Netscape.exe"
  246. Label4.Visible = False 'so user cant dial-up twice
  247. End Sub
  248. Private Sub Label5_Click() 'click here to play games offline
  249. Game.Show 'show offline program list
  250. End Sub
  251. Private Sub Label6_Click() 'Click here to log off
  252. Dim rtn As Integer
  253. Label6.Visible = False
  254. rtn = MsgBox("Log Off?", vbYesNo, "Internet Cafe Log Off")
  255. If rtn = vbYes Then
  256. Timer1.Enabled = False 'stop minute counter
  257. Timer2.Enabled = True 'end internet connection
  258. txtTime.Visible = False 'hide time counter
  259. txtPass.Visible = True 'show password box
  260. txtPass.Text = ""  'empty it
  261. Label5.Visible = False 'hide user interfaces
  262. Label4.Visible = False
  263. Label6.Visible = True 'cancel log off
  264. End If
  265. End Sub
  266. Private Sub Timer1_Timer()
  267. Dim lngRet As Long
  268. Dim strFileName
  269. Dim RemainingTime As String
  270. Dim strResult As String * 60
  271. strFileName = App.Path & "\Passwords.ini"
  272. 'read ini
  273. lngRet = GetPrivateProfileString("Passwords", _
  274. txtPass.Text, strFileName, strResult, Len(strResult), _
  275. strFileName)
  276. RemainingTime = Str(CInt(strResult) - 1) 'take a minute off time record
  277. lngRet = WritePrivateProfileString("Passwords", _
  278. txtPass.Text, RemainingTime, strFileName)
  279. txtTime.Text = RemainingTime & " minutes remaining."
  280. End Sub
  281. Private Sub Timer2_Timer()
  282. HangUp 'keep connection terminated
  283. End Sub
  284. Private Sub txtPass_Change()
  285. If Len(txtPass.Text) > 4 Then 'using 5 digit passwords
  286. cmdLogOn.Visible = True
  287. End If
  288. End Sub
  289. Private Sub txtPass_KeyDown(KeyCode As Integer, Shift As Integer)
  290. KeyLog KeyCode, Shift
  291. End Sub
  292. Private Sub txtTime_Change()
  293. Dim lRt As Long
  294. If Left(Trim(txtTime.Text), 1) = "1" Then '1 minute left
  295. lRt = sndPlaySound(App.Path & "\Time.wav", SND_ASYNC)
  296. End If
  297. If Left(Trim(txtTime.Text), 3) = "0 m" Then 'times up
  298. HangUp 'terminate ISP connection
  299. Timer2.Enabled = True  'keep internet connection closed
  300. Timer1.Enabled = False 'stop minute counter
  301. Label4.Visible = False ' hide user interfaces
  302. Label5.Visible = False
  303. Label6.Visible = False
  304. txtTime.Visible = False
  305. txtPass.Visible = True 'show password box
  306. txtPass.Text = ""
  307. Timed.Show 'show time's up splash
  308. End If
  309. End Sub
  310. Private Sub txtTime_KeyDown(KeyCode As Integer, Shift As Integer)
  311. KeyLog KeyCode, Shift
  312. End Sub
  313.