Hi,

This is my first post on this forum and am relatively new to VB6.

Although there are other similar posts regards my problem, I cannot get any to work for me.

The code (listed below) is a deliberately primitive attempt at a slide show,
without using picture or image boxes - the code is also just an independent BAS module, but can be invoked by a form, if need be.

It works well in that Paint Shop Pro is initiated only once and subsequent jpg files appear over each other after ? seconds specified in the SLEEP command.

My problem, is to replace the SLEEP line with code that allows me to use the ESCAPE or ENTER key to display the next jpg file.

Code:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal _
lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Main()

MyPath = InputBox("Specify full path of .xls file", "Query 1 of 1", "c:\jpg_files")

If MyPath = "" Then End
NextFile = Dir(MyPath & "\*.*")
If NextFile = "" Then MsgBox "Directory does not exist": End
    
Do While Len(NextFile)                         ' Repeats until length of NextFile is ZERO.
   NextFile = Dir                              ' Gets next file name.
   zitpath = MyPath & "\" & NextFile
   ShellExecute 0&, vbNullString, zitpath, vbNullString, vbNullString, vbNormalFocus
   Sleep 500
Loop
   
End

End Sub
I have spent many hours attempting to get this to work with no success.

Can anyone provide me with the solution ?

Thanks and regards,

Zorrozac