Attribute VB_Name = "Module2"

Public Const NewFileColour          As String = &HC0C0C0
Public Const ActiveFileColour       As String = &H8000000F

Public Const Safe_GainControlColour As String = &H80FF80
Public Const Peak_GainControlColour As String = &H80FFFF
Public Const Warn_GainControlColour As String = &HFF&

Public Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" _
    (ByVal lpszLongPath As String, _
    ByVal lpszShortPath As String, _
    ByVal lBuffer As Long) As Long
    
Public Sub OpenSourceFile()
On Error Resume Next

With Form1

    .Text1.BackColor = ActiveFileColour

    .CDialog.CancelError = True
    .CDialog.DialogTitle = "Open Source File"
    .CDialog.FileName = ""
    .CDialog.Filter = "WMA Files (*.wma)|*.wma|MP3 Files (*.mp3)|*.mp3|WAV Files (*.wav)|*.wav|All Files (*.*)|*.*"
    .CDialog.FilterIndex = 4
    .CDialog.InitDir = App.Path & "\"
    
    .CDialog.ShowOpen

If .CDialog.FileName <> vbNullString Then

    DOS_SourceFileName = vbNullString
    DOS_SourceFileName = GetShortPath(.CDialog.FileName)
    
    .Text1.Text = ""
    .Text1.Text = DOS_SourceFileName
    .Text1.BackColor = NewFileColour
    
    .Command1(2).Enabled = True
    .Command1(3).Enabled = True
    .Command1(6).Enabled = True
    .Command1(7).Enabled = True
    .Command1(8).Enabled = True
    
Call .GetSourceDuration


Else

Exit Sub

End If

End With

End Sub
Public Function GetShortPath(strFileName As String) As String
On Error Resume Next

Dim lngRes As Long
Dim strPath As String

    strPath = String(255, 0)
    lngRes = GetShortPathName(strFileName, strPath, 254)

    GetShortPath = Left(strPath, lngRes)
    
End Function




