FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Get User's DeskTop, MyDocuments Path
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Get User's DeskTop, MyDocuments Path
Posted: Mon Jan 19, 2009 09:03 AM

Hi,

How can I get the user's DeskTop Path, My Documents Path

I believe that there are some functions to retrieve these paths.

Any help ?

Regards

Anser

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Get User's DeskTop, MyDocuments Path
Posted: Mon Jan 19, 2009 12:23 PM
#define HKEY_CURRENT_USER  2147483649

#define KEY_ALL_ACCESS 983103


FUNCTION GETDESKDIR()

    LOCAL hKey := 0

    LOCAL nType := 0

    LOCAL cData := SPACE( 256 )

    LOCAL nSize := LEN( cData )

    REGOPENKEY( HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", 0, KEY_ALL_ACCESS, @hKey )

    REGQUERYVALUE( hKey, "Desktop", 0, @nType, @cData, @nSize )

    REGCLOSEKEY( hKey )

    RETURN LEFT( cData, AT( CHR( 0 ), cData ) - 1 )


DLL FUNCTION REGOPENKEY( hKey AS LONG, cSubKey AS LPSTR, nOptions AS DWORD, nSamDesired AS DWORD, @nHandle AS PTR ) AS LONG;
      PASCAL FROM "RegOpenKeyExA" LIB "advapi32.dll"

DLL FUNCTION REGQUERYVALUE( hKey AS LONG, cValueName AS LPSTR, nReserved AS LONG, @nType AS PTR, @cData AS LPSTR, @nSize AS PTR ) AS LONG;
      PASCAL FROM "RegQueryValueExA" LIB "advapi32.dll"

DLL FUNCTION REGCLOSEKEY( hKey AS LONG ) AS LONG;
      PASCAL FROM "RegCloseKey" LIB "advapi32.dll"


EMG
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Get User's DeskTop, MyDocuments Path
Posted: Mon Jan 19, 2009 12:28 PM

Thankyou Mr.EMG,

I thought FWH had some builtin functions similiar to GetWinDir().

Thanks & Regards

Anser

Continue the discussion