View Single Post
Old 05-09-2008, 03:25 PM   #32
CarComp
Maximum Bitrate
 
CarComp's Avatar
 
Join Date: Oct 2001
Location: Indiana
Posts: 502
What does running a configurator have to do with including winamp with the distributable? I'm merely stating why force the user to download a separate program?

As for My Music, RR actually defaults to nowhere. It *should* default to somewhere, and since windows default is "My Music" it should default there. You can always change it. (Hence the setup program asking where it is on first run)

As for looking for a GPS program, you can probably determine from the top 5 if not the top 10. Its not that hard to do, and once again, it would make RR more "out of the box" friendly. And you can always modify these settings later.

And how is having an ini file re-create as default a bad idea? Is it better for the program to completely not function instead? You delete it, it recreates. Simple. If you like your config, why would you delete your file? RR should never delete the ini. I think you misunderstood what I was saying. Also, if RR uses the api's for ini files, you'll never have to worry about it deleting the files, b/c its usually read OR write, but never left hanging open. Windows handles that. I've never seen an ini file get deleted or erased unless the person actually clicks it and deletes it.

EDIT: Ok i found out RR is opening and modifying the ini files itself. what the heck? use the API. It actually deletes the ini file as it replaces it. thats kinda iffy don't you think? Heres some code that will function in a safer manner...

Create a module and call it modINI. Add the module code below to it...The following code includes error handlers, as well as a debug log creating sub for when there are errors which logs the time as well as the error and the subroutine as well as the line number. It is taken from MediaEngine. Feel free to use it.

Read using.......
variable = ReadINI(App.Path & "\rr.ini", "section", "key", vartype CONSTANT)
OR example:

Code:
Dim BrowseHistory as String BrowseHistory = ReadINI(App.Path & "\rr.ini", "main", "BrowseHistory", MString)

Write using......
writeINI App.Path & "\rr.ini","section","key",VARIABLE
OR example:
Code:
Dim sMediaType as String sMediaType = "MP3" WriteINI App.Path & "\rr.ini", "main", "LastPlayMode", sMediaType


modINI.bas "MODULE CODE"
Code:
Option Explicit Public Const MString = 0 Public Const MBool = 1 Public Const MLong = 2 Public Const MInteger = 3 Public Const MVariant = 4 Public Const MSingle = 5 Public Const MDec = 6 Public Const MDouble = 7 'filesystem handlers Public Declare Function GetPrivateProfileString Lib "kernel32" Alias _ "GetPrivateProfileStringA" (ByVal lpApplicationName As String, _ ByVal lpKeyName As String, ByVal lpDefault As String, _ ByVal lpReturnedString As String, ByVal nSize As Long, _ ByVal lpFileName As String) As Long Public Declare Function WritePrivateProfileString Lib "kernel32" Alias _ "WritePrivateProfileStringA" (ByVal lpApplicationName As String, _ ByVal lpKeyName As String, ByVal lpString As Any, _ ByVal lpFileName As String) As Long Function ReadINI(ByVal FileName As String, ByVal Section, ByVal KeyName As String, ByVal VarType As Long) As Variant On Error GoTo ReadINI_Err Dim sRet As String sRet = String(255, Chr(0)) ReadINI = left(sRet, GetPrivateProfileString(Section, ByVal KeyName, "", sRet, Len(sRet), FileName)) If VarType <> MString Then ReadINI = Replace(ReadINI, ".", DecimalSeparator) 'If ReadINI = "" Then ' ErrH "The ReadINI function returned a null value from " & filename & " " & Section & " " & KeyName 'End If Select Case VarType Case 0 Exit Function Case 1 If ReadINI = "" Then fix1: ReadINI = False Exit Function Else On Error GoTo fix1 ReadINI = CBool(ReadINI) End If Case 2 If ReadINI = "" Then fix2: ReadINI = "0" Exit Function Else On Error GoTo fix2 ReadINI = CLng(ReadINI) End If Case 3 If ReadINI = "" Then fix3: ReadINI = "0" Exit Function Else On Error GoTo fix3 ReadINI = CInt(ReadINI) End If Case 4 If ReadINI = "" Then fix4: ReadINI = "0" Exit Function Else On Error GoTo fix4 ReadINI = CVar(ReadINI) End If Case 5 If ReadINI = "" Then fix5: ReadINI = "0" Exit Function Else On Error GoTo fix5 ReadINI = CSng(ReadINI) End If Case 6 If ReadINI = "" Then fix6: ReadINI = "0" Exit Function Else On Error GoTo fix6 ReadINI = CDec(ReadINI) End If Case 7 If ReadINI = "" Then fix7: ReadINI = "0" Exit Function Else On Error GoTo fix7 ReadINI = CDbl(ReadINI) End If Case Else On Error Resume Next ReadINI = CStr(ReadINI) End Select Exit Function ReadINI_Err: errh "An error occured in modIni.ReadINI " & _ " ", Err.Description, Err.Number End Function Function WriteINI(ByVal sFilename, ByVal sSection As String, ByVal sKeyName As String, ByVal sNewString As String) As Integer On Error GoTo WriteINI_Err Dim r r = WritePrivateProfileString(sSection, sKeyName, sNewString, sFilename) WriteINI = r Exit Function WriteINI_Err: errh "An error occured in modIni.WriteINI " & _ " ", Err.Description, Err.Number End Function Public Sub DeleteSection(strFile As String, strSection As String) On Error GoTo DeleteSection_Err WritePrivateProfileString strSection, vbNullString, vbNullString, strFile Exit Sub DeleteSection_Err: errh "An error occured in modIni.DeleteSection " & _ " ", Err.Description, Err.Number End Sub Public Sub DeleteKey(strFile As String, strSection As String, strKey As String) On Error GoTo DeleteKey_Err WritePrivateProfileString strSection, strKey, vbNullString, strFile Exit Sub DeleteKey_Err: errh "An error occured in modIni.DeleteKey " & _ " ", Err.Description, Err.Number End Sub Public Sub errh(ErrInfo As String, errmsg As String, errnum As Long, Optional ByVal ExitApp As Boolean) 'Main Error Handling Function 'on error GoTo ErrH_Err Dim ErrMsg1 As String ErrMsg1 = ErrInfo & " : " & errmsg & " : Error number " & CStr(errnum) WriteLog ErrMsg1 If errmsg = "Skin Error" Then Exit Sub MsgBox ErrMsg1 & vbCrLf & "Click ok to terminate the application", vbCritical, "RR Fatal Error" Close 'Close any and all open files Dim Form As Form For Each Form In Forms Unload Form Set Form = Nothing Next Form End Sub Public Sub WriteLog(ByVal sMessage As String) On Error GoTo WriteLog_err Dim iFF As Integer Dim sDebugBuffer As String Dim sDebugLog As String sDebugBuffer = Now & " - " & sMessage iFF = FreeFile sDebugLog = App.Path & "\debug.log" If FileExists(sDebugLog) Then Open sDebugLog For Append As #iFF Else Open sDebugLog For Output As #iFF End If Print #iFF, sDebugBuffer Close iFF Exit Sub WriteLog_err: If Err.Number <> 0 Or Err.Number = 67 Then If Err.Number = 55 Then Exit Sub ' file already open Else Resume Next End If End Sub

__________________
Get MediaEngine !!!
Media Engine Download

Last edited by CarComp; 05-09-2008 at 03:47 PM.
CarComp is offline   Reply With Quote