LZ请使用以下代码: Private Const VK_ESCAPE = &H1B ' 代表Esc键 Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer ' 功能:判断用户是否按下某一个键 Private Function CheckKey(lngKey As Long) As Boolean If GetAsyncKeyState(lngKey) Then CheckKey = True Else CheckKey = False End If End Function 想要在过程中的那个位置按"ESC"退出程序,在相应位置加入如下代码: If CheckKey(VK_ESCAPE) = True Then End '退出程序 End If |