Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- VERSION 5.00
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
- Begin VB.Form Form1
- BorderStyle = 4 'Fixed ToolWindow
- Caption = "Gæt et tal mellem 1 og 100"
- ClientHeight = 4275
- ClientLeft = 45
- ClientTop = 285
- ClientWidth = 6075
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4275
- ScaleWidth = 6075
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 'CenterScreen
- Begin VB.Frame Frame3
- Caption = "Cheats"
- Height = 975
- Left = 240
- TabIndex = 23
- Top = 3120
- Width = 3015
- Begin VB.CheckBox Check1
- Caption = "Se facit"
- Height = 195
- Left = 960
- TabIndex = 24
- Top = 240
- Width = 975
- End
- Begin VB.CommandButton Command6
- Caption = "&OK"
- Height = 285
- Left = 2040
- TabIndex = 27
- Top = 480
- Visible = 0 'False
- Width = 495
- End
- Begin VB.TextBox Text1
- Alignment = 2 'Center
- Enabled = 0 'False
- Height = 285
- Left = 480
- TabIndex = 26
- Text = "000"
- Top = 480
- Visible = 0 'False
- Width = 1455
- End
- Begin VB.TextBox Text3
- Height = 285
- IMEMode = 3 'DISABLE
- Left = 480
- PasswordChar = "*"
- TabIndex = 25
- Text = "test"
- Top = 480
- Visible = 0 'False
- Width = 1455
- End
- Begin VB.Label Label12
- Caption = "indtast password"
- Height = 255
- Left = 480
- TabIndex = 28
- Top = 240
- Visible = 0 'False
- Width = 1335
- End
- End
- Begin VB.Frame Frame2
- Caption = "Stats"
- Height = 1215
- Left = 3480
- TabIndex = 18
- Top = 480
- Width = 2415
- Begin VB.Label Label4
- Caption = "Antal Gæt:"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 360
- TabIndex = 22
- Top = 360
- Width = 1215
- End
- Begin VB.Label Label5
- Caption = "Antal Spil:"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 360
- TabIndex = 21
- Top = 600
- Width = 1095
- End
- Begin VB.Label Label10
- Caption = "0"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 1560
- TabIndex = 20
- Top = 600
- Width = 615
- End
- Begin VB.Label Label11
- Caption = "0"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 1560
- TabIndex = 19
- Top = 360
- Width = 615
- End
- End
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 4440
- Top = 240
- _ExtentX = 847
- _ExtentY = 847
- _Version = 393216
- End
- Begin VB.Timer Timer2
- Left = 3480
- Top = 240
- End
- Begin VB.Timer Timer1
- Left = 3960
- Top = 240
- End
- Begin VB.TextBox Text5
- Height = 285
- Left = 3480
- TabIndex = 5
- Text = "Game.txt"
- Top = 1920
- Width = 2415
- End
- Begin VB.TextBox Text4
- Height = 285
- Left = 240
- MaxLength = 10
- TabIndex = 4
- Text = "Player1"
- Top = 720
- Width = 3015
- End
- Begin VB.CommandButton Command7
- Caption = "Hent Game"
- Height = 375
- Left = 4680
- TabIndex = 3
- Top = 2280
- Width = 1215
- End
- Begin VB.CommandButton Command5
- Caption = "A&bout"
- Height = 375
- Left = 3480
- TabIndex = 2
- Top = 3720
- Width = 855
- End
- Begin VB.CommandButton Command4
- Caption = "Gem resultat"
- Height = 375
- Left = 3480
- TabIndex = 1
- Top = 2280
- Width = 1095
- End
- Begin VB.CommandButton Command2
- Caption = "E&xit"
- Height = 375
- Left = 5040
- TabIndex = 0
- Top = 3720
- Width = 855
- End
- Begin VB.Frame Frame1
- Caption = "Spil"
- Height = 1815
- Left = 240
- TabIndex = 12
- Top = 1200
- Width = 3015
- Begin VB.CommandButton Command1
- Caption = "Ny Tal (PC)"
- Height = 255
- Left = 1320
- TabIndex = 16
- Top = 240
- Width = 1095
- End
- Begin VB.CommandButton Command3
- Caption = "Passer tallet"
- Enabled = 0 'False
- Height = 255
- Left = 480
- TabIndex = 15
- Top = 600
- Width = 1935
- End
- Begin VB.TextBox Text2
- Enabled = 0 'False
- Height = 285
- IMEMode = 3 'DISABLE
- Left = 480
- MaxLength = 3
- TabIndex = 14
- Text = "1"
- Top = 240
- Width = 735
- End
- Begin VB.HScrollBar HScroll1
- Enabled = 0 'False
- Height = 255
- Left = 480
- Max = 100
- Min = 1
- TabIndex = 13
- Top = 960
- Value = 1
- Width = 1935
- End
- Begin VB.Label Label3
- Alignment = 2 'Center
- BorderStyle = 1 'Fixed Single
- Caption = "Tillykke Player1, du gættede rigtigt"
- Height = 375
- Left = 120
- TabIndex = 17
- Top = 1320
- Width = 2775
- End
- End
- Begin VB.Label Label8
- Caption = "Intast dit navn:"
- Height = 255
- Left = 240
- TabIndex = 10
- Top = 480
- Width = 1095
- End
- Begin VB.Image Image1
- Height = 900
- Left = 3360
- Picture = "Form1.frx":0000
- Top = 2760
- Visible = 0 'False
- Width = 960
- End
- Begin VB.Label Label9
- Caption = "Filenavn:"
- Height = 255
- Left = 3480
- TabIndex = 11
- Top = 1680
- Width = 735
- End
- Begin VB.Label Label7
- Caption = "##"
- Height = 255
- Left = 5400
- TabIndex = 9
- Top = 3000
- Width = 375
- End
- Begin VB.Label Label6
- Caption = "##"
- Height = 255
- Left = 4560
- TabIndex = 8
- Top = 3000
- Width = 375
- End
- Begin VB.Label Label2
- Caption = "Gæt et tal mellem 1 og 100"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 1680
- TabIndex = 7
- Top = 120
- Width = 2415
- End
- Begin VB.Label Label1
- Caption = "Label1"
- Height = 255
- Left = 4320
- TabIndex = 6
- Top = 3840
- Width = 855
- End
- Begin VB.Shape Shape2
- BackColor = &H000040C0&
- BackStyle = 1 'Opaque
- BorderStyle = 6 'Inside Solid
- FillColor = &H0000FFFF&
- Height = 855
- Left = 5280
- Shape = 2 'Oval
- Top = 2760
- Width = 615
- End
- Begin VB.Shape Shape1
- BackColor = &H000000C0&
- BackStyle = 1 'Opaque
- FillStyle = 7 'Diagonal Cross
- Height = 855
- Left = 4440
- Top = 2760
- Width = 615
- End
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Public number As Integer
- Public guesstotal As Integer
- Public totalgame As Integer
- Dim guessnumber As Integer
- Dim guess As Integer
- Dim pcnumber As Integer
- Private Declare Function sndPlaySound Lib "WINMM.DLL" Alias _
- "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As _
- Long) As Long
- Const SND_SYNC = &H0
- Const SND_ASYNC = &H1
- Const SND_NODEFAULT = &H2
- Const SND_LOOP = &H8
- Const SND_NOSTOP = &H10
- Private Sub Check1_Click()
- If Check1.Value = 1 Then
- Check1.Visible = False
- Label12.Visible = True
- Text3.Visible = True
- Command6.Visible = True
- Command6.Enabled = True
- Text3.SetFocus
- Else
- Text1.Visible = False
- Command6.Visible = False
- End If
- End Sub
- Private Sub Command1_Click()
- Randomize Timer
- pcnumber = Int(Rnd * 100) + 1
- Text1.Text = pcnumber
- Command1.Enabled = False
- Command3.Enabled = True
- HScroll1.Enabled = True
- Text2.Enabled = True
- Text2.Text = "1"
- HScroll1.Value = 1
- Label3.Caption = ""
- totalgame = totalgame + 1
- Label10.Caption = totalgame
- guess = 0
- Label11.Caption = 0
- Image1.Visible = False
- End Sub
- Private Sub Command2_Click()
- Dim choice As Integer
- 'Exit promt
- choice = MsgBox("Exit?", vbOKCancel + vbExclamation, "Gæt et tal mellem 1 og 100")
- If choice = vbOK Then
- choice = MsgBox("Er du sikker på du vil afslutte programmet?", vbYesNo + vbInformation, "Gæt et tal mellem 1 og 100")
- If choice = vbNo Then
- GoTo 200
- Else
- End
- End If
- Else
- End If
- 200
- End Sub
- Private Sub Command3_Click()
- guessnumber = Val(Text2.Text)
- 'If no number is present
- If guessnumber = 0 Or guesstotal > 100 Then
- MsgBox "Du skal indtaste et tal mellem 1 og 100"
- 'Text2.Text = ""
- Else
- 'if a guess number is present check to see if to high, more then +5
- If guessnumber > pcnumber + 5 Then
- Label3.Caption = "Du gættede alt for højt"
- Else
- 'guess number is close
- If guessnumber > pcnumber Then
- Label3.Caption = "Nu er du tæt på, men stadig for højt"
- End If
- End If
- If guessnumber = pcnumber Then
- SoundName$ = "C:\WINDOWS\Media\tada.wav" 'Win XP/7
- wFlags% = SND_ASYNC Or SND_NODEFAULT
- X% = sndPlaySound(SoundName$, wFlags%)
- Label3.Caption = "Tillykke " + Text4.Text + ", du gættede rigtigt"
- Command1.Enabled = True
- Command3.Enabled = False
- Image1.Visible = True
- Text2.Enabled = False
- End If
- If guessnumber < pcnumber - 5 Then
- Label3.Caption = "de gættede for lavt"
- Else
- If guessnumber < pcnumber Then
- Label3.Caption = "Nu er du tæt på, men stadig for lavt"
- End If
- End If
- guess = guess + 1
- guesstotal = guesstotal + 1
- Label11.Caption = guess
- End If
- End Sub
- Private Sub Command4_Click()
- 'Set flags
- CommonDialog1.Flags = cdlOFNHideReadOnly + cdlOFNOverwritePrompt + cdlOFNPathMustExist
- 'Set filters
- CommonDialog1.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|"
- 'Display the Save dialog box
- CommonDialog1.FileName = "Game.txt"
- CommonDialog1.ShowSave
- Open CommonDialog1.FileName For Output As #1
- Write #1, Text4.Text; "Antal gæt i alt"; guesstotal; "Antal Spil"; Label10.Caption
- 'Text4.Text; ": "; "Antal gæt i alt"; " "; guesstotal; " "; "Antal Spil"; " "; Label10.Caption
- Close
- 'Set the label values
- Text5.Text = CommonDialog1.FileName
- 'Open Text5.Text For Output As #1
- 'Print #1, Text4.Text; ": "; "Antal gæt i alt"; " "; guesstotal; " "; "Antal Spil"; " "; Label10.Caption
- 'Print #1, guesstotal
- 'Print #1, totalgame
- 'Print #1, Text4.Text
- End Sub
- Private Sub Command5_Click()
- Load Form2
- Form2.Show
- Form2.Label2.Caption = guesstotal
- Form2.Label4.Caption = totalgame
- If Label10.Caption > 0 Then
- Form2.Label7.Caption = guesstotal / totalgame
- number = guesstotal / totalgame
- End If
- 'write on form2
- Select Case number
- Case 0
- Form2.Label8.Caption = "Du har ikke gættet tallet endnu"
- Case 1 To 2
- Form2.Label8.Caption = "Super, har du gættet passwordet?"
- Case 3, 4
- Form2.Label8.Caption = "Expert"
- Case 5, 6
- Form2.Label8.Caption = "okay, men det kunne være bedre"
- Case Else
- Form2.Label8.Caption = "Skidt, Prøv med halveringsmetoden"
- End Select
- End Sub
- Private Sub Command6_Click()
- If Text3.Text = "test" Then
- Text1.Visible = True
- Label12.Visible = False
- Text3.Visible = False
- Command6.Enabled = False
- Check1.Visible = True
- Else
- Text1.Visible = False
- Label12.Visible = False
- Text3.Visible = False
- Command6.Visible = False
- Check1.Visible = True
- Check1.Value = 0
- End If
- End Sub
- Private Sub Command7_Click()
- On Error GoTo errhandler
- CommonDialog1.CancelError = False
- ' Set flags
- CommonDialog1.Flags = cdlOFNHideReadOnly + cdlOFNPathMustExist + cdlOFNFileMustExist
- ' Set filters
- CommonDialog1.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*|"
- ' Display the Save dialog box
- CommonDialog1.FileName = ""
- CommonDialog1.ShowOpen
- ' Set the label values
- Text5.Text = CommonDialog1.FileName
- Exit Sub
- errhandler:
- Select Case Err
- Case 32755 ' Dialog Cancelled
- MsgBox "you cancelled the dialog box"
- Case Else
- MsgBox "Unexpected error. Err " & Err & " : " & Error
- End Select
- 'Open Text5.Text For Input As #1
- 'Line Input #1, inputdata 'Read line of data (first line no need)
- 'Line Input #1, inputdata 'Total guess
- 'guesstotal = inputdata
- 'Line Input #1, inputdata 'read total game
- 'totalgame = inputdata
- 'Line Input #1, inputdata 'read name of player
- 'Text4.Text = inputdata
- 'Label10.Caption = totalgame
- 'Label11.Caption = guesstotal
- End Sub
- Private Sub Form_Load()
- Label3.Caption = ""
- End Sub
- Private Sub HScroll1_scroll()
- Text2.Text = HScroll1.Value
- End Sub
- Private Sub HScroll1_Change()
- Text2.Text = HScroll1.Value
- End Sub
- Private Sub Image1_Click()
- SoundName$ = "C:\WINDOWS\Media\tada.wav" 'Win XP/7
- wFlags% = SND_ASYNC Or SND_NODEFAULT
- X% = sndPlaySound(SoundName$, wFlags%)
- End Sub
- Private Sub Text2_KeyPress(KeyAscii As Integer)
- If KeyAscii = vbKeyReturn Then
- Call Command3_Click
- End If
- End Sub
- Private Sub Text2_Change()
- 'HScroll1.Value = Text2.Text
- If Text2.Text = 0 Or Text2.Text > 100 Then
- MsgBox "Du skal indtaste et tal mellem 1 og 100"
- End If
- End Sub
- Private Sub Timer1_Timer()
- Label6.Visible = False
- Label7.Visible = True
- Label7.Caption = Int(Rnd * 100)
- Shape1.Visible = False
- Shape2.Visible = True
- Timer1.Enabled = False
- Timer2.Enabled = True
- End Sub
- Private Sub Timer2_Timer()
- Label7.Visible = False
- Label6.Visible = True
- Label6.Caption = Int(Rnd * 100)
- Shape2.Visible = False
- Shape1.Visible = True
- Timer2.Enabled = False
- Timer1.Enabled = True
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement