August 04, 2020, 12:40:55 PM

Author Topic: BRL.Volumes.mod and ShellFolders  (Read 134 times)

Offline _PJ_

  • Jr. Member
  • **
  • Posts: 92
BRL.Volumes.mod and ShellFolders
« on: July 23, 2020, 03:18:34 PM »
There is a function
GetCustomDir(..)

Which takes an CSIDL Integer as argument.
Is there an alternative that might use GUID strings for special ShellFolders (Windows only) or, alternatively the GUID are represented as Int Arrays as are defined in BRL.Volumes.mod/vol_win.bmx

 Global _FOLDERID_*

But there exists no converstion to "friendly" CSIDL Integer constant in that file for the required directory (notably,  It has no CSIDL here
https://docs.microsoft.com/en-gb/windows/win32/shell/knownfolderid?redirectedfrom=MSDN
)

Since Windows users of other languages will have differently named folders, I cannot force a relative path from the "UserProfile" either.

One alternative may be to use a separate Extern to grab registry entries and retrieve the full path from
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

However, this registry key is typically a legacy feature, so may not be reliable in future.

Does anyone have a workaround to obtain the full real path for a particulalr Known ShellFolder which does not have a 'friendly' CSIDL, but does have an Int Array _FOLDERID_* listed in "vol_win.bmx" ?

Offline Henri

  • Sr. Member
  • ****
  • Posts: 250
Re: BRL.Volumes.mod and ShellFolders
« Reply #1 on: July 23, 2020, 04:27:40 PM »
Hi,

you can call SHGetKnownFolderPath directly. It support folderID's (GUIDS as I understand them)

Something like:
Code: BlitzMax
  1.  
  2. Import brl.volumes
  3.  
  4. Local b:Short Ptr
  5.  
  6. SHGetKnownFolderPath(_FOLDERID_Videos, 0, 0, Varptr b)
  7.  
  8. Local dir:String = String.fromWString(b)
  9. CoTaskMemFree(b)
  10.  
  11. Print dir
  12.  

-Henri
- Got 01100011 problems, but the bit ain't 00000001

Offline _PJ_

  • Jr. Member
  • **
  • Posts: 92
Re: BRL.Volumes.mod and ShellFolders
« Reply #2 on: July 23, 2020, 04:44:47 PM »
Henri! You are   a genius and lifesaver!
That works perfectly, thanks very much.

Offline Scaremonger

  • Jr. Member
  • **
  • Posts: 84
    • ITSpeedway - Ramblings of a geek!
Re: BRL.Volumes.mod and ShellFolders
« Reply #3 on: July 24, 2020, 05:45:32 PM »
Hi,
Brucey has a volumes module available that is cross platform. Might be worth a look in his library:

https://github.com/maxmods/bah.mod

Si...
Follow me at ITSpeedway.net.

Offline Henri

  • Sr. Member
  • ****
  • Posts: 250
Re: BRL.Volumes.mod and ShellFolders
« Reply #4 on: July 24, 2020, 08:54:54 PM »
Hi Scaremonger,

you might have been out for a while as volumes is now part of the core modules of NG as hinted in the example.

-Henri
- Got 01100011 problems, but the bit ain't 00000001

Offline Scaremonger

  • Jr. Member
  • **
  • Posts: 84
    • ITSpeedway - Ramblings of a geek!
Re: BRL.Volumes.mod and ShellFolders
« Reply #5 on: July 26, 2020, 09:32:56 PM »
Oh, cool...

Yes, I've been away from Blitzmax/NG for a while now.
Follow me at ITSpeedway.net.

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal