Jump to content
Sign in to follow this  
Achilles

Please test a _GetMusicDir() function

Recommended Posts

Achilles

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]

Share this post


Link to post
Share on other sites
Decker87

It worked for me on XP. I have my music at the default location.

Share this post


Link to post
Share on other sites
BrettF

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

Share this post


Link to post
Share on other sites
Achilles

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]

Share this post


Link to post
Share on other sites
BrettF

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

Share this post


Link to post
Share on other sites
Backnor

works on Vista home ult

Share this post


Link to post
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
Sign in to follow this  

×