VERSION 5.00 Begin VB.Form Form1 BackColor = &H80000016& BorderStyle = 0 'なし Caption = "Form1" ClientHeight = 9735 ClientLeft = 0 ClientTop = 0 ClientWidth = 9960 FillColor = &H80000003& ForeColor = &H80000015& LinkTopic = "Form1" ScaleHeight = 9735 ScaleWidth = 9960 ShowInTaskbar = 0 'False StartUpPosition = 3 'Windows の既定値 WindowState = 2 '最大化 Begin VB.CommandButton OK Caption = "確定" BeginProperty Font Name = "MS Pゴシック" Size = 20.25 Charset = 128 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 615 Left = 5280 TabIndex = 14 Top = 1440 Width = 1095 End Begin VB.CommandButton Command10 Caption = "0" BeginProperty Font Name = "MS Pゴシック" Size = 24 Charset = 128 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 615 Left = 1440 TabIndex = 12 Top = 3240 Width = 1095 End Begin VB.CommandButton Back Caption = "戻る" BeginProperty Font Name = "MS Pゴシック" Size = 20.25 Charset = 128 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 615 Left = 2040 TabIndex = 11 Top = 2280 Width = 1095 End Begin VB.CommandButton Clear Caption = "消去" BeginProperty Font Name = "MS Pゴシック" Size = 20.25 Charset = 128 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 585 Left = 3600 TabIndex = 10 Top = 1440 Width = 1095 End Begin VB.CommandButton Command3 BackColor = &H00FFFFFF& Caption = "3" BeginProperty Font Name = "MS Pゴシック" Size = 24 Charset = 128 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 615 Left = 7680 TabIndex = 9 Top = 4200 Width = 1095 End Begin VB.CommandButton Command9 Caption = "9" BeginProperty Font Name = "MS Pゴシック" Size = 24 Charset = 128 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 615 Left = 1200 TabIndex = 8 Top = 4200 Width = 1095 End Begin VB.CommandButton Command8 Caption = "8" BeginProperty Font Name = "MS Pゴシック" Size = 24 Charset = 128 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 615 Left = 1680 TabIndex = 7 Top = 5160 Width = 1095 End Begin VB.CommandButton Command7 Caption = "7" BeginProperty Font Name = "MS Pゴシック" Size = 24 Charset = 128 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 615 Left = 2640 TabIndex = 6 Top = 6120 Width = 1095 End Begin VB.CommandButton Command6 Caption = "6" BeginProperty Font Name = "MS Pゴシック" Size = 24 Charset = 128 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 615 Left = 4440 TabIndex = 5 Top = 6480 Width = 1095 End Begin VB.CommandButton Command5 Caption = "5" BeginProperty Font Name = "MS Pゴシック" Size = 24 Charset = 128 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 615 Left = 6240 TabIndex = 4 Top = 6120 Width = 1095 End Begin VB.CommandButton Command4 Caption = "4" BeginProperty Font Name = "MS Pゴシック" Size = 24 Charset = 128 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 615 Left = 7080 MaskColor = &H000000FF& TabIndex = 3 Top = 5160 Width = 1095 End Begin VB.CommandButton Command2 Caption = "2" BeginProperty Font Name = "MS Pゴシック" Size = 24 Charset = 128 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 615 Left = 7440 TabIndex = 2 Top = 3240 Width = 1095 End Begin VB.CommandButton Command1 BackColor = &H00FFFFC0& Caption = "1" BeginProperty Font Name = "MS Pゴシック" Size = 24 Charset = 128 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 615 Left = 6600 TabIndex = 1 Top = 2280 Width = 1095 End Begin VB.Label Label2 BorderStyle = 1 '実線 BeginProperty Font Name = "MS Pゴシック" Size = 26.25 Charset = 128 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 975 Left = 840 TabIndex = 13 Top = 240 Width = 8295 End Begin VB.Label Label1 Alignment = 1 '右揃え BorderStyle = 1 '実線 BeginProperty Font Name = "MS Pゴシック" Size = 36 Charset = 128 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 855 Left = 2880 TabIndex = 0 Top = 8040 Width = 4215 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Type POINTAPI X As Long Y As Long End Type Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Boolean Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Boolean Dim mX As Integer Dim mY As Integer Dim Flag As Boolean Dim flag2 As Integer Dim FileNamber As Integer Dim StrTxt As String Dim time1 Public Function MyMouse(i As String) Call MyMove If Timer - time1 > 0.8 Then If Flag Then 'ここから由香里作 If flag2 = 1 Then 'flag2=1、すなわち金額入力のとき If Len(Label1.Caption) < 8 Then Label1.Caption = Label1.Caption & i & 円 Else Label2.Caption = "1千万以上はお引き落としできません。" Label1.Caption = "" End If Flag = False Else 'flag2=0、すなわち暗証番号入力のとき If Len(Label1.Caption) < 4 Then Label1.Caption = Label1.Caption & i Else Label2.Caption = "暗証番号は4桁です。" End If Flag = False End If 'ここまで End If time1 = Timer End If End Function Public Sub MyMove() Dim mPos As POINTAPI GetCursorPos mPos If Abs(mPos.X - mX) > 0 Or Abs(mPos.Y - mY) > 0 Then If mPos.Y - mY > 0 Then If mY < 10 Then mY = 10 SetCursorPos mPos.X, mY Else mY = mY - Abs(mPos.Y - mY) SetCursorPos mPos.X, mY End If Else If mY > 720 Then mY = 720 SetCursorPos mPos.X, mY Else mY = mY + Abs(mPos.Y - mY) SetCursorPos mPos.X, mY End If End If mX = mPos.X End If End Sub Private Sub Back_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call MyMove If Timer - time1 > 0.8 Then If Len(Label1.Caption) <> 0 Then If Flag Then Label1.Caption = Left(Label1.Caption, Len(Label1.Caption) - 1) Flag = False End If End If time1 = Timer End If End Sub Private Sub Clear_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call MyMove If Timer - time1 > 0.8 Then If flag2 <> 2 Then If Flag Then Label1.Caption = "" OK.Caption = "確定" Clear.Caption = "消去" Flag = False End If time1 = Timer Else flag2 = 1 Label2.Caption = "金額をいれてください" End If End If End Sub Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) MyMouse (Command1.Caption) End Sub Private Sub Command10_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) MyMouse (Command10.Caption) End Sub Private Sub Command2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) MyMouse (Command2.Caption) End Sub Private Sub Command3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) MyMouse (Command3.Caption) End Sub Private Sub Command4_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) MyMouse (Command4.Caption) End Sub Private Sub Command5_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) MyMouse (Command5.Caption) End Sub Private Sub Command6_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) MyMouse (Command6.Caption) End Sub Private Sub Command7_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) MyMouse (Command7.Caption) End Sub Private Sub Command8_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) MyMouse (Command8.Caption) End Sub Private Sub Command9_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) MyMouse (Command9.Caption) End Sub Private Sub Form_Load() mX = 300 mY = 300 SetCursorPos mX, mY FileNamber = 1 Open "ID.txt" For Input As #FileNamber Input #FileNamber, StrTxt Close #FileNamber Label2.Caption = "4ケタの暗証番号を入力してください" Flag = True flag2 = 0 time1 = Timer End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Flag = True Call MyMove End Sub Private Sub OK_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call MyMove If Timer - time1 > 0.8 Then If Flag Then '連続禁止 'ここから由香里作 Select Case flag2 'flag2は、金額か暗証番号かを表すフラッグ Case 0 If StrTxt <> Label1.Caption Then '暗証番号が、間違っていた場合 Label2.Caption = "間違っています。もう一度やり直してください" Label2.ForeColor = RGB(255, 0, 0) Label1.Caption = "" Else '暗証番号があってれば金額入力へ Label2.Caption = "金額を入れてください" Label2.ForeColor = RGB(0, 0, 0) Label1.Caption = "" flag2 = 1 End If Case 1 '金額入力でOKが押された If Len(Label1.Caption) > 3 Then Label2.Caption = Label1.Caption & "円でよろしいですか?" OK.Caption = "YES" Clear.Caption = "NO" flag2 = 2 Else Label2.Caption = "お引き落としは1000円からです。" End If Case 2 Label2.Caption = "現金をおとりください。ありがとうございました。" End 'プログラム終了 'ここまで End Select Flag = False End If time1 = Timer End If End Sub