Projects

Find all our projects in development below.
All source code is GNU General Public License (GPL)

RemoteAmp

Browsing Client/MainForm.frm (33.79 KB)

VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form MainForm 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "RemoteAmp Control Panel"
   ClientHeight    =   4815
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   11415
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "MainForm.frx":0000
   MaxButton       =   0   'False
   ScaleHeight     =   4815
   ScaleWidth      =   11415
   StartUpPosition =   2  'CenterScreen
   Begin VB.Frame Frame6 
      Caption         =   "Winamp &Playlist (0 Total)"
      Height          =   3735
      Left            =   7560
      TabIndex        =   34
      Top             =   120
      Width           =   3735
      Begin VB.ListBox List1 
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   6.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   3360
         ItemData        =   "MainForm.frx":1272
         Left            =   120
         List            =   "MainForm.frx":1274
         TabIndex        =   35
         Top             =   240
         Width           =   3495
      End
   End
   Begin VB.Frame Frame5 
      Caption         =   "Song Information"
      Height          =   1215
      Left            =   3240
      TabIndex        =   52
      Top             =   120
      Width           =   4215
      Begin VB.Label Label19 
         Caption         =   "0 khz"
         Height          =   255
         Left            =   3240
         TabIndex        =   62
         Top             =   840
         Width           =   735
      End
      Begin VB.Label Label18 
         Caption         =   "Samplerate:"
         Height          =   255
         Left            =   2280
         TabIndex        =   61
         Top             =   840
         Width           =   975
      End
      Begin VB.Label Label17 
         Caption         =   "0 kbps"
         Height          =   255
         Left            =   1320
         TabIndex        =   60
         Top             =   840
         Width           =   735
      End
      Begin VB.Label Label16 
         Caption         =   "00:00:00"
         Height          =   255
         Left            =   3240
         TabIndex        =   59
         Top             =   600
         Width           =   735
      End
      Begin VB.Label Label15 
         Caption         =   "Song Pos:"
         Height          =   255
         Left            =   2280
         TabIndex        =   58
         Top             =   600
         Width           =   855
      End
      Begin VB.Label Label14 
         Caption         =   "00:00:00"
         Height          =   255
         Left            =   1320
         TabIndex        =   57
         Top             =   600
         Width           =   735
      End
      Begin VB.Label Label13 
         Caption         =   "Bitrate:"
         Height          =   255
         Left            =   120
         TabIndex        =   56
         Top             =   840
         Width           =   615
      End
      Begin VB.Label Label12 
         Caption         =   "Song Length:"
         Height          =   255
         Left            =   120
         TabIndex        =   55
         Top             =   600
         Width           =   1095
      End
      Begin VB.Label Label11 
         Height          =   255
         Left            =   1320
         TabIndex        =   54
         Top             =   360
         Width           =   2775
      End
      Begin VB.Label Label10 
         Caption         =   "Song Name:"
         Height          =   255
         Left            =   120
         TabIndex        =   53
         Top             =   360
         Width           =   975
      End
   End
   Begin VB.Frame Frame4 
      Caption         =   "Song Position"
      Height          =   735
      Left            =   120
      TabIndex        =   14
      Top             =   2280
      Width           =   2295
      Begin VB.HScrollBar HScroll3 
         Height          =   255
         LargeChange     =   5
         Left            =   120
         Max             =   100
         TabIndex        =   15
         TabStop         =   0   'False
         Top             =   300
         Width           =   1575
      End
      Begin VB.Label Label9 
         AutoSize        =   -1  'True
         Caption         =   "0%"
         Height          =   195
         Left            =   1800
         TabIndex        =   51
         Top             =   315
         Width           =   255
      End
   End
   Begin VB.Frame Frame3 
      Caption         =   "Balance"
      Height          =   735
      Left            =   5160
      TabIndex        =   18
      Top             =   2280
      Width           =   2295
      Begin VB.HScrollBar HScroll2 
         Height          =   255
         LargeChange     =   40
         Left            =   120
         Max             =   255
         TabIndex        =   19
         TabStop         =   0   'False
         Top             =   300
         Value           =   127
         Width           =   1575
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         Caption         =   "Cntr"
         Height          =   195
         Left            =   1800
         TabIndex        =   50
         Top             =   315
         Width           =   315
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "Volume"
      Height          =   735
      Left            =   2640
      TabIndex        =   16
      Top             =   2280
      Width           =   2295
      Begin VB.HScrollBar HScroll1 
         Height          =   255
         LargeChange     =   40
         Left            =   120
         Max             =   255
         TabIndex        =   17
         TabStop         =   0   'False
         Top             =   300
         Value           =   255
         Width           =   1575
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "100%"
         Height          =   195
         Left            =   1800
         TabIndex        =   49
         Top             =   315
         Width           =   435
      End
   End
   Begin VB.CommandButton cmdDisconnect 
      Caption         =   "&Disconnect"
      Height          =   375
      Left            =   4388
      Style           =   1  'Graphical
      TabIndex        =   0
      ToolTipText     =   "Disconnect from the RemoteAmp server"
      Top             =   4200
      Width           =   1455
   End
   Begin VB.Frame fraMsg 
      Caption         =   "&Track"
      Height          =   735
      Index           =   1
      Left            =   120
      TabIndex        =   1
      Top             =   1440
      Width           =   7335
      Begin VB.CommandButton cmdTrackFadeout 
         Caption         =   "Fade"
         Height          =   375
         Left            =   3120
         Style           =   1  'Graphical
         TabIndex        =   7
         ToolTipText     =   "Fadeout and Stop"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdTrackPrev 
         Caption         =   "|<"
         Height          =   375
         Left            =   120
         Style           =   1  'Graphical
         TabIndex        =   2
         ToolTipText     =   "Previous track"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdTrackNext 
         Caption         =   ">|"
         Height          =   375
         Left            =   720
         Style           =   1  'Graphical
         TabIndex        =   3
         ToolTipText     =   "Next track"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdTrackPlay 
         Caption         =   "->"
         Height          =   375
         Left            =   1320
         Style           =   1  'Graphical
         TabIndex        =   4
         ToolTipText     =   "Play"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdTrackPause 
         Caption         =   "||"
         Height          =   375
         Left            =   1920
         Style           =   1  'Graphical
         TabIndex        =   5
         ToolTipText     =   "Pause"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdTrackStop 
         Caption         =   "S"
         Height          =   375
         Left            =   2520
         Style           =   1  'Graphical
         TabIndex        =   6
         ToolTipText     =   "Stop"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdTrackStopAfter 
         Caption         =   "|S"
         Height          =   375
         Left            =   3720
         Style           =   1  'Graphical
         TabIndex        =   8
         ToolTipText     =   "Stop after current track"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdTrackFForward 
         Caption         =   ">>"
         Height          =   375
         Left            =   4920
         Style           =   1  'Graphical
         TabIndex        =   10
         ToolTipText     =   "Forward 5 seconds"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdFRewind 
         Caption         =   "<<"
         Height          =   375
         Left            =   4320
         Style           =   1  'Graphical
         TabIndex        =   9
         ToolTipText     =   "Rewind 5 seconds"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdTrackOpenFile 
         Caption         =   "File"
         Height          =   375
         Left            =   5520
         Style           =   1  'Graphical
         TabIndex        =   11
         ToolTipText     =   "Open file dialog"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdTrackOpenURL 
         Caption         =   "URL"
         Height          =   375
         Left            =   6120
         Style           =   1  'Graphical
         TabIndex        =   12
         ToolTipText     =   "Open URL dialog"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdTrackInfo 
         Caption         =   "Info"
         Height          =   375
         Left            =   6720
         Style           =   1  'Graphical
         TabIndex        =   13
         ToolTipText     =   "Open file info box"
         Top             =   240
         Width           =   495
      End
   End
   Begin VB.Frame fraMsg 
      Caption         =   "P&laylist"
      Height          =   735
      Index           =   2
      Left            =   7560
      TabIndex        =   36
      Top             =   3960
      Width           =   3735
      Begin VB.CommandButton cmdSave 
         Caption         =   "Save"
         Height          =   375
         Left            =   1920
         Style           =   1  'Graphical
         TabIndex        =   40
         ToolTipText     =   "Save the playlist"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdClear 
         Caption         =   "Clear"
         Height          =   375
         Left            =   2520
         Style           =   1  'Graphical
         TabIndex        =   41
         ToolTipText     =   "Clear the playlist"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdRefresh 
         Caption         =   "(R)"
         Height          =   375
         Left            =   3120
         Style           =   1  'Graphical
         TabIndex        =   42
         ToolTipText     =   "Refresh the playlist"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdShow 
         Caption         =   "Add"
         Height          =   375
         Left            =   1320
         Style           =   1  'Graphical
         TabIndex        =   39
         ToolTipText     =   "Add a file to the playlist"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdListStart 
         Caption         =   "|<<"
         Height          =   375
         Left            =   120
         Style           =   1  'Graphical
         TabIndex        =   37
         ToolTipText     =   "Jump to start of playlist"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdListEnd 
         Caption         =   ">>|"
         Height          =   375
         Left            =   720
         Style           =   1  'Graphical
         TabIndex        =   38
         ToolTipText     =   "Jump to end of playlist"
         Top             =   240
         Width           =   495
      End
   End
   Begin VB.Frame fraMsg 
      Caption         =   "&Visualization"
      Height          =   735
      Index           =   3
      Left            =   120
      TabIndex        =   21
      Top             =   3120
      Width           =   3975
      Begin VB.CommandButton cmdVisPlugInOptions 
         Caption         =   "Config"
         Height          =   375
         Left            =   2040
         Style           =   1  'Graphical
         TabIndex        =   24
         ToolTipText     =   "Open visualization plug-in options"
         Top             =   240
         Width           =   855
      End
      Begin VB.CommandButton cmdVisDispElapsed 
         Caption         =   "Elapsed"
         Height          =   375
         Left            =   120
         Style           =   1  'Graphical
         TabIndex        =   22
         ToolTipText     =   "Set time display mode to elapsed"
         Top             =   240
         Width           =   855
      End
      Begin VB.CommandButton cmdVisDispRemaining 
         Caption         =   "Remaining"
         Height          =   375
         Left            =   1080
         Style           =   1  'Graphical
         TabIndex        =   23
         ToolTipText     =   "Set time display mode to remaining"
         Top             =   240
         Width           =   855
      End
      Begin VB.CommandButton cmdVisPlugInExec 
         Caption         =   "Run/Stop"
         Height          =   375
         Left            =   3000
         Style           =   1  'Graphical
         TabIndex        =   25
         ToolTipText     =   "Execute/stop current visualization plug-in"
         Top             =   240
         Width           =   855
      End
   End
   Begin VB.Frame fraMsg 
      Caption         =   "T&oggle..."
      Height          =   735
      Index           =   4
      Left            =   120
      TabIndex        =   32
      Top             =   3960
      Width           =   2535
      Begin VB.ComboBox cboToggle 
         Height          =   315
         ItemData        =   "MainForm.frx":1276
         Left            =   120
         List            =   "MainForm.frx":12A4
         Style           =   2  'Dropdown List
         TabIndex        =   33
         Top             =   280
         Width           =   2295
      End
   End
   Begin VB.Frame fraMsg 
      Caption         =   "&Miscellaneous"
      Height          =   735
      Index           =   6
      Left            =   4320
      TabIndex        =   26
      Top             =   3120
      Width           =   3135
      Begin VB.CommandButton cmdMiscJumpToTime 
         Caption         =   "J-Time"
         Height          =   375
         Left            =   120
         Style           =   1  'Graphical
         TabIndex        =   27
         ToolTipText     =   "Open jump to time dialog"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdMiscJumpToFile 
         Caption         =   "J-File"
         Height          =   375
         Left            =   720
         Style           =   1  'Graphical
         TabIndex        =   28
         ToolTipText     =   "Open jump to file dialog"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdMiscSkinSelector 
         Caption         =   "Skins"
         Height          =   375
         Left            =   1320
         Style           =   1  'Graphical
         TabIndex        =   29
         ToolTipText     =   "Open skin selector"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdMiscSkinReload 
         Caption         =   "(R)"
         Height          =   375
         Left            =   1920
         Style           =   1  'Graphical
         TabIndex        =   30
         ToolTipText     =   "Reload the current skin"
         Top             =   240
         Width           =   495
      End
      Begin VB.CommandButton cmdMiscClose 
         Caption         =   "End"
         Height          =   375
         Left            =   2520
         Style           =   1  'Graphical
         TabIndex        =   31
         ToolTipText     =   "Close Winamp"
         Top             =   240
         Width           =   495
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "Winamp Information"
      Height          =   1215
      Left            =   120
      TabIndex        =   20
      Top             =   120
      Width           =   3015
      Begin VB.Label Label6 
         Alignment       =   1  'Right Justify
         Height          =   255
         Left            =   1320
         TabIndex        =   48
         Top             =   360
         Width           =   1575
      End
      Begin VB.Label Label5 
         Alignment       =   1  'Right Justify
         Caption         =   "Not Playing"
         Height          =   255
         Left            =   1320
         TabIndex        =   47
         Top             =   600
         Width           =   1575
      End
      Begin VB.Label Label4 
         Alignment       =   1  'Right Justify
         Caption         =   "None"
         Height          =   255
         Left            =   1320
         TabIndex        =   46
         Top             =   840
         Width           =   1575
      End
      Begin VB.Label Label3 
         Caption         =   "Last Command:"
         Height          =   255
         Left            =   120
         TabIndex        =   45
         Top             =   840
         Width           =   1215
      End
      Begin VB.Label Label2 
         Caption         =   "Play Status:"
         Height          =   255
         Left            =   120
         TabIndex        =   44
         Top             =   600
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "Version:"
         Height          =   255
         Left            =   120
         TabIndex        =   43
         Top             =   360
         Width           =   1215
      End
   End
   Begin MSWinsockLib.Winsock Winsck 
      Left            =   0
      Top             =   0
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
   End
End
Attribute VB_Name = "MainForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Dim bNoSetPos As Boolean

Dim WinampPlaylistRecv As String
Dim WinampPlaylistIndex As Integer

Private Const AppRegRoot = "Software\RemoteAmp\Client\"

Sub LastCmd(strCmd As String)
    Label4.Caption = strCmd
End Sub


Function ParseStr(ParseChar As String, ParseNum As Integer, ParseString As String) As String
Dim i As Integer
Dim i2 As Integer
Dim Num As Integer
    Num = 0
    Do
        i2 = i
        Num = Num + 1
        i = InStr(i2 + Len(ParseChar), ParseString, ParseChar)
        If i = 0 Then
            i = Len(ParseString) + Len(ParseChar)
            Exit Do
        End If
    Loop While Num < ParseNum
    If Num = ParseNum Then
        ParseStr = Mid(ParseString, i2 + Len(ParseChar), i - i2 - Len(ParseChar))
        Exit Function
    End If
    ParseStr = ""
End Function
Sub SendData(strdata As String)
    Enabled = False
    Winsck.SendData strdata
End Sub


Private Sub cboToggle_Click()
    Select Case cboToggle.ListIndex
        Case 0      ' Preferences Screen
            LastCmd "TogglePreferences"
            SendData "toggle_preferences"
        Case 1      ' About Box
            LastCmd "ToggleAbout"
            SendData "toggle_about"
        Case 2      ' Title Autoscrolling
            LastCmd "ToggleAutoscroll"
            SendData "toggle_autoscroll"
        Case 3      ' Always on top
            LastCmd "ToggleAlwaysOnTop"
            SendData "toggle_alwaysontop"
        Case 4      ' Windowshade
            LastCmd "ToggleWindowshadeMain"
            SendData "toggle_windowshademain"
        Case 5      ' Playlist Windowshade
            LastCmd "ToggleWindowshadeList"
            SendData "toggle_windowshadelist"
        Case 6      ' Doublesize mode
            LastCmd "ToggleDoublesize"
            SendData "toggle_doublesize"
        Case 7      ' EQ
            LastCmd "ToggleEQ"
            SendData "toggle_eq"
        Case 8      ' Playlist editor
            LastCmd "ToggleList"
            SendData "toggle_list"
        Case 9      ' Main window visible
            LastCmd "ToggleMain"
            SendData "toggle_main"
        Case 10     ' Minibrowser
            LastCmd "ToggleBrowser"
            SendData "toggle_browser"
        Case 11     ' Easymove
            LastCmd "ToggleEasyMove"
            SendData "toggle_easymove"
        Case 12     ' Repeat
            LastCmd "ToggleRepeat"
            SendData "toggle_repeat"
        Case 13     ' Shuffle
            LastCmd "ToggleShuffle"
            SendData "toggle_shuffle"
    End Select
    cboToggle.ListIndex = -1
End Sub


Private Sub cmdClear_Click()
    LastCmd "PlaylistClear"
    SendData "playlist_clear"
End Sub

Private Sub cmdDisconnect_Click()
    Unload Me
End Sub

Private Sub cmdFRewind_Click()
    LastCmd "TrackRev5sec"
    SendData "track_rew5sec"
End Sub

Private Sub cmdListEnd_Click()
    LastCmd "PlaylistEnd"
    SendData "playlist_end"
End Sub

Private Sub cmdListStart_Click()
    LastCmd "PlaylistStart"
    SendData "playlist_start"
End Sub

Private Sub cmdMiscClose_Click()
    LastCmd "TerminateWinamp"
    SendData "cmd_closewinamp"
End Sub

Private Sub cmdMiscJumpToFile_Click()
    LastCmd "ShowJumpToFile"
    SendData "cmd_jumptofile"
End Sub

Private Sub cmdMiscJumpToTime_Click()
    LastCmd "ShowJumpToTime"
    SendData "cmd_jumptotime"
End Sub

Private Sub cmdMiscSkinReload_Click()
    LastCmd "WinampReloadSkin"
    SendData "cmd_reloadskin"
End Sub

Private Sub cmdMiscSkinSelector_Click()
    LastCmd "ShowSkinsSelector"
    SendData "cmd_skinsselector"
End Sub

Private Sub cmdRefresh_Click()
    LastCmd "PlaylistRefresh"
    SendData "playlist_refresh"
End Sub

Private Sub cmdSave_Click()
    LastCmd "PlaylistSave"
    SendData "playlist_write"
End Sub

Private Sub cmdShow_Click()
Dim Str As String
    Str = InputBox("Enter the location of the song on the remote host:", "Add Song To Playlist")
    If Str <> "" Then
        LastCmd "PlaylistAddSong"
        SendData "playlist_add" & vbNullChar & Str
    End If
End Sub

Private Sub cmdTrackFadeout_Click()
    LastCmd "TrackFadeout"
    SendData "track_fadeout"
End Sub

Private Sub cmdTrackFForward_Click()
    LastCmd "TrackFor5sec"
    SendData "track_for5sec"
End Sub

Private Sub cmdTrackInfo_Click()
    LastCmd "DispTrackInfo"
    SendData "track_showinfo"
End Sub

Private Sub cmdTrackNext_Click()
    LastCmd "TrackNext"
    SendData "track_next"
End Sub

Private Sub cmdTrackOpenFile_Click()
    LastCmd "OpenFileDialog"
    SendData "cmd_openfile"
End Sub

Private Sub cmdTrackOpenURL_Click()
    LastCmd "OpenURLDialog"
    SendData "cmd_openurl"
End Sub


Private Sub cmdTrackPause_Click()
    LastCmd "TrackPause"
    SendData "track_pause"
End Sub

Private Sub cmdTrackPlay_Click()
    LastCmd "TrackPlay"
    SendData "track_play"
End Sub


Private Sub cmdTrackPrev_Click()
    LastCmd "TrackPrev"
    SendData "track_prev"
End Sub

Private Sub cmdTrackStop_Click()
    LastCmd "TrackStop"
    SendData "track_stop"
End Sub

Private Sub cmdTrackStopAfter_Click()
    LastCmd "TrackStopAfter"
    SendData "track_stopafter"
End Sub

Private Sub cmdVisDispElapsed_Click()
    LastCmd "VisElapsed"
    SendData "vis_elapsed"
End Sub

Private Sub cmdVisDispRemaining_Click()
    LastCmd "VisRemaining"
    SendData "vis_remaining"
End Sub


Private Sub cmdVisPlugInExec_Click()
    LastCmd "VisRunStopPlugin"
    SendData "vis_startstopplugin"
End Sub

Private Sub cmdVisPlugInOptions_Click()
    LastCmd "VisShowConfig"
    SendData "vis_showconfig"
End Sub


Private Sub Form_Load()
    CButtonAll Me
    CenterFrameCaptionAll Me
    bNoSetPos = False
    WinampPlaylistRecv = ""
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Winsck.Close
    ConnectForm.ResetCmdBtn
    ConnectForm.Show
End Sub


Private Sub HScroll1_Change()
    Label7.Caption = Int((HScroll1.Value / HScroll1.Max) * 100) & "%"
    LastCmd "SetVolume"
    SendData "winamp_setvolume" & vbNullChar & HScroll1.Value
End Sub

Private Sub HScroll1_Scroll()
    Label7.Caption = Int((HScroll1.Value / HScroll1.Max) * 100) & "%"
End Sub


Private Sub HScroll2_Change()
Dim Balance As Integer
    Balance = Int(IIf(HScroll2.Value < 128, 128 - HScroll2.Value, HScroll2.Value - 127) / 12.8)
    Label8.Caption = IIf(Balance = 0, "Cntr", IIf(HScroll2.Value < 128, "- " & Balance, "+ " & Balance))
    LastCmd "SetBalance"
    SendData "winamp_setbalance" & vbNullChar & HScroll2.Value
End Sub

Private Sub HScroll2_Scroll()
Dim Balance As Integer
    Balance = Int(IIf(HScroll2.Value < 128, 128 - HScroll2.Value, HScroll2.Value - 127) / 12.8)
    Label8.Caption = IIf(Balance = 0, "Cntr", IIf(HScroll2.Value < 128, "- " & Balance, "+ " & Balance))
End Sub


Private Sub HScroll3_Change()
    Label9.Caption = Int((HScroll3.Value / HScroll3.Max) * 100) & "%"
    If Not bNoSetPos Then
        LastCmd "SetSongPos"
        SendData "track_setsongpos" & vbNullChar & ((HScroll3.Value / 100) * Val(Label14.Tag))
    End If
End Sub

Private Sub HScroll3_Scroll()
    Label9.Caption = Int((HScroll3.Value / HScroll3.Max) * 100) & "%"
End Sub


Private Sub List1_DblClick()
    LastCmd "PlaySelectedTrack"
    SendData "track_playex" & vbNullChar & List1.ListIndex
End Sub

Private Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If List1.ListIndex = 0 Then
        List1.ToolTipText = ""
    Else
        List1.ToolTipText = (List1.ListIndex + 1) & ". " & List1.List(List1.ListIndex)
    End If
End Sub


Private Sub Winsck_Close()
    MsgBox "The connection was closed by the remote host.", vbExclamation, "RemoteAmp Connection"
    Hide
    ConnectForm.Show
    ConnectForm.ResetCmdBtn
End Sub

Private Sub Winsck_Connect()
    ConnectForm.StatusLabel.Caption = "Connection established; Sending password..."
    SendData "remoteamp_login" & vbNullChar & App.Major & "." & App.Minor & IIf(App.Revision = 0, "", "." & App.Revision) & vbNullChar & ConnectForm.Text1.Text
End Sub

Private Sub Winsck_DataArrival(ByVal bytesTotal As Long)
On Error Resume Next
Dim RecvData As String
Dim strArray(20) As String
Dim i As Integer
    Winsck.GetData RecvData
    i = 1
    Do While ParseStr(vbNullChar, i, RecvData) <> ""
        strArray(i) = ParseStr(vbNullChar, i, RecvData)
        i = i + 1
    Loop
    
    If strArray(1) = "remoteamp_login_reply" Then
        If Val(strArray(2)) = 1 Then
            Dim bItemFound As Boolean
            ConnectForm.StatusLabel.Caption = "Password accepted; Receiving Winamp information..."
            SendData "get_winampinfo"
            bItemFound = False
            If ConnectForm.Combo1.ListCount > 0 Then
                For i = 0 To ConnectForm.Combo1.ListCount - 1
                    If LCase(ConnectForm.Combo1.List(i)) = LCase(ConnectForm.Combo1.Text) Then
                        bItemFound = True
                        Exit For
                    End If
                Next i
            End If
            If Not bItemFound Then ConnectForm.Combo1.AddItem ConnectForm.Combo1.Text
        ElseIf Val(strArray(2)) = -1 Then
            MsgBox "RemoteAmp client and RemoteAmp server version mismatch.", vbCritical, "Connection Error"
            ConnectForm.ResetCmdBtn
        Else
            MsgBox "The password was not accepted by the remote host." & vbCrLf & vbCrLf & "Re-type the password and try again.", vbCritical, "Connection Error"
            ConnectForm.ResetCmdBtn
        End If
    ElseIf strArray(1) = "get_winampinfo_reply" Then
        Label6.Caption = strArray(2)
        Label5.Caption = IIf(Val(strArray(3)) = 0, "Not Playing", IIf(Val(strArray(3)) = 1, "Playing", "Paused"))
        strArray(4) = Replace(strArray(4), "&", "&&")
        Label11.Caption = CEllipse(hDC, Label11.Width, strArray(4), DT_WORD_ELLIPSIS)
        Label11.ToolTipText = strArray(4)
        If strArray(4) <> "" Then
            Label14.Caption = strArray(5)
            Label16.Caption = strArray(6)
            Label14.Tag = strArray(7)
            Label16.ToolTipText = strArray(8) & "%"
            bNoSetPos = True: HScroll3.Value = (Val(strArray(8)) / 100) * HScroll3.Max: bNoSetPos = False
            Label17.Caption = strArray(9) & " kbps"
            Label19.Caption = strArray(10) & " khz"
        End If
        ConnectForm.StatusLabel.Caption = "Received Winamp information, loading control panel..."
        ConnectForm.Hide
        Caption = "RemoteAmp Control Panel - Connected to " & Winsck.RemoteHostIP
        Show
    ElseIf strArray(1) = "winamp_update_info" Then
        Label5.Caption = IIf(Val(strArray(2)) = 0, "Not Playing", IIf(Val(strArray(2)) = 1, "Playing", "Paused"))
        strArray(3) = Replace(strArray(3), "&", "&&")
        Label11.Caption = CEllipse(hDC, Label11.Width, strArray(3), DT_WORD_ELLIPSIS)
        Label11.ToolTipText = strArray(3)
        Label14.Caption = IIf(Val(strArray(2)) > 0, strArray(4), "00:00:00")
        Label14.Tag = strArray(6)
        Label16.Caption = IIf(Val(strArray(2)) > 0, strArray(5), "00:00:00")
        Label16.ToolTipText = IIf(Val(strArray(2)) > 0, strArray(7) & "%", "0%")
        bNoSetPos = True: HScroll3.Value = IIf(Val(strArray(2)) > 0, (Val(strArray(7)) / 100) * HScroll3.Max, 0): bNoSetPos = False
        Label17.Caption = IIf(Val(strArray(2)) > 0, strArray(8) & " kbps", "0 kbps")
        Label19.Caption = IIf(Val(strArray(2)) > 0, strArray(9) & " khz", "0 khz")
    ElseIf strArray(1) = "winamp_not_running" Then
        Winsck.Close
        MsgBox "Winamp was terminated or is not running on the remote computer anymore.", vbExclamation
        Hide
        ConnectForm.ResetCmdBtn
        ConnectForm.Show
    ElseIf strArray(1) = "playlist_refresh_reply" Or WinampPlaylistRecv <> "" Then
        If WinampPlaylistRecv = "" Then
            WinampPlaylistIndex = Val(strArray(2))
            WinampPlaylistRecv = strArray(3)
        Else
            WinampPlaylistRecv = WinampPlaylistRecv + RecvData
        End If
        If InStr(WinampPlaylistRecv, Chr(2)) Then
            List1.Clear
            WinampPlaylistRecv = Left(WinampPlaylistRecv, InStr(WinampPlaylistRecv, Chr(2)) - 1)
            i = 1
            Do While ParseStr(Chr(1), i, WinampPlaylistRecv) <> ""
                List1.AddItem ParseStr(Chr(1), i, WinampPlaylistRecv)
                i = i + 1
            Loop
            If WinampPlaylistIndex < List1.ListCount Then
                List1.ListIndex = WinampPlaylistIndex
            End If
            Frame6.Caption = "Winamp &Playlist (" & (i - 1) & " Total)"
            WinampPlaylistRecv = ""
        End If
    End If
End Sub


Private Sub Winsck_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    If Number = sckConnectionReset Then
        MsgBox "There are no available connections on the remote host." & vbCrLf & vbCrLf & "Please try again later.", vbCritical, "Connection Error"
    Else
        MsgBox "Winsock Error: " + Description, vbCritical
    End If
    If Not MainForm.Visible Then
        Winsck.Close
        ConnectForm.ResetCmdBtn
    End If
End Sub


Private Sub Winsck_SendComplete()
    Enabled = True
End Sub


Download Client/MainForm.frm

Back to file list


Back to project page