Code:
Private Sub Form_Load()
Dim SNumb As Integer
Dim i As Integer
Dim PStatus As String
Dim RetVal
Dim PWinamp As String
Dim PTitle As String
PStatus = GetPlayStatus
'Load Keyboard and IR Remote settings.
InputSetup
'Default Playlist Loading
PDirect = ReadINI("settings", "pdirectory", App.Path & "\" & "mp3shell.ini")
PlayList = ReadINI("settings", "playlist", App.Path & "\" & "mp3shell.ini")
If FileExist(PDirect & PlayList) = False Then
cdgFile.CancelError = True
On Error GoTo ErrHandler
MsgBox "Default Playlist was not found.", vbOKOnly, "Playlist Open"
cdgFile.Filter = "Playlists (*.pls)|*.pls"
cdgFile.DialogTitle = "Please Select Default Playlist..."
cdgFile.ShowOpen
WriteINI "settings", "pdirectory", Replace(cdgFile.filename, cdgFile.FileTitle, ""), App.Path & "\" & "mp3shell.ini"
WriteINI "settings", "playlist", cdgFile.FileTitle, App.Path & "\" & "mp3shell.ini"
PDirect = ReadINI("settings", "pdirectory", App.Path & "\" & "mp3shell.ini")
PlayList = ReadINI("settings", "playlist", App.Path & "\" & "mp3shell.ini")
End If
SNumb = ReadINI("playlist", "NumberOfEntries", PDirect & PlayList)
PWinamp = ReadINI("settings", "winamp", App.Path & "\" & "mp3shell.ini")
If FileExist(PWinamp) = False Then
' cdgFile.CancelError = True
' On Error GoTo ErrHandlerAmp
' MsgBox "Winamp EXE Not Found, please select.", vbOKOnly, "Open Winamp"
Rinse:
' cdgFile.Filter = "Winamp.exe File (*.exe)|*.exe"
' cdgFile.DialogTitle = "Please Select Winamp.exe file..."
' cdgFile.ShowOpen
'PTitle = Format(cdgFile.FileTitle, "<")
If PTitle = "winamp.exe" Then
WriteINI "settings", "winamp", cdgFile.filename, App.Path & "\" & "mp3shell.ini"
Else
MsgBox "Selected file is not Winamp.", , "Error"
GoTo Rinse
End If
End If
PWinamp = ReadINI("settings", "winamp", App.Path & "\" & "mp3shell.ini")
RetVal = Shell(PWinamp & " " & PDirect & PlayList, 4)
For i = 1 To SNumb
lstPlay.AddItem ReadINI("playlist", "Title" & i, PDirect & PlayList)
Next i
lstPlay.Selected(0) = True
'Direct Input Code
Set DI = dx.DirectInputCreate() 'create the object, must be done before anything else
If Err.Number <> 0 Then 'if err=0 then there are no errors.
MsgBox "Error starting Direct Input, please make sure you have DirectX installed", vbApplicationModal
End
End If
Set diDEV = DI.CreateDevice("GUID_SysKeyboard") 'Create a keyboard object off the Input object
diDEV.SetCommonDataFormat DIFORMAT_KEYBOARD 'specify it as a normal keyboard, not mouse or joystick
diDEV.SetCooperativeLevel Me.hWnd, DISCL_BACKGROUND Or DISCL_NONEXCLUSIVE
Me.Show
diDEV.Acquire
If PStatus = 0 Then
Playing = False
dPaused = False
End If
If PStatus = 1 Then
Playing = True
dPaused = False
lstPlay.Selected(GetTrack) = True
End If
If PStatus = 3 Then
Playing = False
dPaused = True
End If
CurTra = 0
InitRemote
Form1.Show
Exit Sub
ErrHandler:
MsgBox "No Playlist Selected, Exiting.", vbOKOnly, "Playlist Open"
End
ErrHandlerAmp:
MsgBox "Improper Winamp File, Exiting.", vbOKOnly, "Find Winamp"
End
ExitSub:
End Sub
Bookmarks