Jump to content

Please test a _GetMusicDir() function


Recommended Posts

Hello, I'm creating a media player and wanted a way to get the music dir of the user... I think I've got it figured out by I don't have XP to check.. Please check:

$name = _GetMusicDir()
Msgbox(0, '', $name)

Func _GetMusicDir() 
    If @OSVersion = 'WIN_VISTA' then 
        Return @UserProfileDir & '\Music' 
    Else 
        Return @MyDocumentsDir & '\My Music' 
    EndIf 
EndFunc
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

All good here.

Wouldn't the location be in the registry somewhere?

I found these in the registry...

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

http://www.kellys-korner-xp.com/xp_shell_folders.htm

Not sure if there's anything else muttley

Link to comment
Share on other sites

Thanks for that Bert, I hadn't thought of the registry. Please test this now, it works on Vista:

$name = _GetMusicDir()
Msgbox(0, '', $name)

Func _GetMusicDir() 
;~  If @OSVersion = 'WIN_VISTA' then 
;~      Return @UserProfileDir & '\Music' 
;~  Else 
;~      Return @MyDocumentsDir & '\My Music' 
;~  EndIf 
    Return RegRead('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', 'My Music')
EndFunc
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Thanks for that Bert, I hadn't thought of the registry. Please test this now, it works on Vista:

$name = _GetMusicDir()
Msgbox(0, '', $name)

Func _GetMusicDir() 
;~  If @OSVersion = 'WIN_VISTA' then 
;~      Return @UserProfileDir & '\Music' 
;~  Else 
;~      Return @MyDocumentsDir & '\My Music' 
;~  EndIf 
    Return RegRead('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', 'My Music')
EndFunc
XP Pro SP2 all good... muttley
Link to comment
Share on other sites

XP Pro SP2 all good... :)

Swe XP Home SP3 also good muttley

(but the first one would never have worked since "My Music" is translated on local versions)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...