VERSION 5.00 Begin VB.Form Form1 BorderStyle = 0 'なし Caption = "Form1" ClientHeight = 8040 ClientLeft = 0 ClientTop = 0 ClientWidth = 9510 LinkTopic = "Form1" ScaleHeight = 8040 ScaleWidth = 9510 ShowInTaskbar = 0 'False StartUpPosition = 3 'Windows の既定値 WindowState = 2 '最大化 Begin VB.CommandButton OK Caption = "確定" Height = 615 Left = 4920 TabIndex = 14 Top = 1560 Width = 1095 End Begin VB.CommandButton Command10 Caption = "0" Height = 615 Left = 1800 TabIndex = 12 Top = 3240 Width = 1095 End Begin VB.CommandButton Back Caption = "戻る" Height = 615 Left = 2400 TabIndex = 11 Top = 2280 Width = 1095 End Begin VB.CommandButton Clear Caption = "消去" Height = 585 Left = 3480 TabIndex = 10 Top = 1560 Width = 1095 End Begin VB.CommandButton Command3 Caption = "3" Height = 615 Left = 7080 TabIndex = 9 Top = 4200 Width = 1095 End Begin VB.CommandButton Command9 Caption = "9" Height = 615 Left = 1440 TabIndex = 8 Top = 4200 Width = 1095 End Begin VB.CommandButton Command8 Caption = "8" Height = 615 Left = 1800 TabIndex = 7 Top = 5160 Width = 1095 End Begin VB.CommandButton Command7 Caption = "7" Height = 615 Left = 2760 TabIndex = 6 Top = 6120 Width = 1095 End Begin VB.CommandButton Command6 Caption = "6" Height = 615 Left = 4320 TabIndex = 5 Top = 6480 Width = 1095 End Begin VB.CommandButton Command5 Caption = "5" Height = 615 Left = 5880 TabIndex = 4 Top = 6120 Width = 1095 End Begin VB.CommandButton Command4 Caption = "4" Height = 615 Left = 6720 TabIndex = 3 Top = 5160 Width = 1095 End Begin VB.CommandButton Command2 Caption = "2" Height = 615 Left = 6720 TabIndex = 2 Top = 3240 Width = 1095 End Begin VB.CommandButton Command1 Caption = "1" Height = 615 Left = 6000 TabIndex = 1 Top = 2280 Width = 1095 End Begin VB.Label Label2 BorderStyle = 1 '実線 Height = 375 Left = 360 TabIndex = 13 Top = 240 Width = 4455 End Begin VB.Label Label1 Alignment = 1 '右揃え BorderStyle = 1 '実線 Height = 375 Left = 6000 TabIndex = 0 Top = 240 Width = 2775 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 Label1.Caption = Label1.Caption & i Flag = False 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 = FreeFile Open "ID.txt" For Input As #FileNamber Input #FileNamber, StrTxt Close #FileNamber Label2.Caption = "暗証番号を入力してください" 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 '金額か暗証番号かを表すフラッグ 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 If Label1.Caption <> "" Then Label2.Caption = "この金額でよろしいですか?" flag2 = 2 OK.Caption = "YES" Clear.Caption = "NO" End If Case 2 End End Select Flag = False End If time1 = Timer End If End Sub