Newsgroup: it.comp.programmare.win32
Titolo: Directory "document and Setting"

Come faccio ad impostare tale directory sul mio prorgamma non sapendo il
path a priori ?
Grazie
Giuseppe

Devi usare queste due API:
SHGetSpecialFolderLocation
Con questa ottieni una struttura contenente le informazioni richieste. In
particolare, la costante CSIDL_PERSONAL restituisce il path dei documenti
(da cui tronchi i caratteri finali per ottenere il path fino a "Documents
and Settings\user"
SHGetPathFromIDList
Questa API estrae il path dalla struttura restituita dalla API di sopra
Allego un pň di help:
Retrieves the location of a special folder.
WINSHELLAPI HRESULT WINAPI SHGetSpecialFolderLocation(;
    HWND hwndOwner,
    int nFolder,
    LPITEMIDLIST *ppidl
   );
Parameters
hwndOwner
Handle of the owner window that the client should specify if it displays a
dialog box or message box.
nFolder
Value specifying the folder to retrieve the location of. This parameter can
be one of the following values:
CSIDL_BITBUCKET Recycle bin ž file system directory containing file objects
in the user's recycle bin. The location of this directory is not in the
registry; it is marked with the hidden and system attributes to prevent the
user from moving or deleting it.
CSIDL_CONTROLS Control Panel ž virtual folder containing icons for the
control panel applications.
CSIDL_DESKTOP Windows desktop ž virtual folder at the root of the name
space.
CSIDL_DESKTOPDIRECTORY File system directory used to physically store file
objects on the desktop (not to be confused with the desktop folder itself).
CSIDL_DRIVES My Computer ž virtual folder containing everything on the local
computer: storage devices, printers, and Control Panel. The folder may also
contain mapped network drives.
CSIDL_FONTS Virtual folder containing fonts.
CSIDL_NETHOOD File system directory containing objects that appear in the
network neighborhood.
CSIDL_NETWORK Network Neighborhood ž virtual folder representing the top
level of the network hierarchy.
CSIDL_PERSONAL File system directory that serves as a common respository for
documents.
CSIDL_PRINTERS Printers folder ž virtual folder containing installed
printers.
CSIDL_PROGRAMS File system directory that contains the user's program groups
(which are also file system directories).
CSIDL_RECENT File system directory that contains the user's most recently
used documents.
CSIDL_SENDTO File system directory that contains Send To menu items.
CSIDL_STARTMENU File system directory containing Start menu items.
CSIDL_STARTUP File system directory that corresponds to the user's Startup
program group.
CSIDL_TEMPLATES File system directory that serves as a common repository for
document templates.
ppidl
Address that receives a pointer to an item identifier list specifying the
folder's location relative to the root of the name space (the desktop).
Return Values
Returns NOERROR if successful or an OLE-defined error result otherwise.
Converts an item identifier list to a file system path.
WINSHELLAPI BOOL WINAPI SHGetPathFromIDList(
    LPCITEMIDLIST pidl,
    LPSTR pszPath
   );
Parameters
pidl
Pointer to an item identifier list that specifies a file or directory
location relative to the root of the name space (the desktop).
pszPath
Pointer to a buffer that receives the file system path. The size of this
buffer is assumed to be MAX_PATH bytes.
Return Values
Returns TRUE if successful or FALSE if an error occurs ž for example, if the
location specified by the pidl parameter is not part of the file system.