#If VBA7 And Win64 Then
Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongPtr)
#Else
Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#End If


Private Declare PtrSafe Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long


Private Declare PtrSafe Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Dim y As Integer
Dim x As Integer
Dim count As Integer
Dim z As Double

Private Const SND_LOOP = &H8
Private Const SND_ASYNC = &H1

Dim ts As String
Dim ID As Integer
Dim Lesson As String


Sub IDD()
ID = Val(InputBox("ID:"))
MsgBox ("哈囉！" & ID & "歡迎參加練習")
End Sub

Sub Lesson1()
Lesson = InputBox("Lesson:")
MsgBox ("開始練習囉！")
End Sub


Sub Wrong()
sndPlaySound "D:\PowerPointPerception\wrong.wav", SND_LOOP
y = y + 1
MsgBox ("不對喔! 要仔細聽喔!")
End Sub


Sub Right()
sndPlaySound "D:\PowerPointPerception\right.wav", SND_LOOP
x = x + 1
SlideShowWindows(1).View.Next
End Sub

Sub Reset()
x = 0
y = 0
MsgBox ("已完成分數重設!")
End Sub

Sub PercentCorrect()
z = (x) / (x + y) * 100
c = x + y
ts = Str(z)
MsgBox ("總共回答了" & c & "次，你答對了" & x & "次，反應正確率:" & Left(ts, 6) & "%")

 Open ("D:\PowerPointPerception\score.txt") For Append As #1
 Print #1, Now & "  個案編號:  " & ID & " 課程編號:   " & Lesson & "  正確率: " & Left(ts, 6) & " %" & vbCrLf
 Close #1

End Sub






