Has anyone used the SHGetKnownFolderPath API function in VO yet? I've played around with it, but never get a result. Last attempt was:
DEFINE FOLDERID_SkyDrive := "{A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}"
_dll function SHGetKnownFolderPath(pszGUID as psz,dwFlags as dword,hHandle as ptr,pOut ref psz) as logic pascal:Shell32.SHGetKnownFolderPath
function getOneDriveDir() as string pascal
local cRueck as string
local pszPath as psz
pszPath := memalloc( MAX_PATH )
if SHGetKnownFolderPath( string2psz(FOLDERID_SkyDrive), 0, NULL, @pszpath )
? "success"
cRueck := psz2string( pszPath )
endif
memfree( pszPath )
return cRueck
Has anyone used the SHGetKnownFolderPath API function in VO yet? I've played around with it, but never get a result. Last attempt was:
DEFINE FOLDERID_SkyDrive := "{A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}"
_dll function SHGetKnownFolderPath(pszGUID as psz,dwFlags as dword,hHandle as ptr,pOut ref psz) as logic pascal:Shell32.SHGetKnownFolderPath
function getOneDriveDir() as string pascal
local cRueck as string
local pszPath as psz
pszPath := memalloc( MAX_PATH )
if SHGetKnownFolderPath( string2psz(FOLDERID_SkyDrive), 0, NULL, @pszpath )
? "success"
cRueck := psz2string( pszPath )
endif
memfree( pszPath )
return cRueck
Stefan,
This was tricky to find the solution for as I never used before.
I was getting a success but only the letter C was returned. I found out
the pszPath returned as WCHAR type. VO has undocumented function to
return the correct result using W2String() which uses Win32 WideCharToMultiByte() and VO's Mem2String() to return the full path correctly.
Here is the full working code. Let me know how it goes.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 42:50:39 |
Calls: | 10,392 |
Files: | 14,064 |
Messages: | 6,417,215 |