erlug
[Top] [All Lists]

[Erlug] Della serie: programmazione base di sistema, domande 3 e 4

To: "'erlug@xxxxxxxxxxxxxx'" <erlug@xxxxxxxxxxxxxx>
Subject: [Erlug] Della serie: programmazione base di sistema, domande 3 e 4
From: Alessandro Forghieri <Alessandro.Forghieri@xxxxxxxxxx>
Date: Thu, 13 Feb 2003 13:47:36 +0100
--Domanda 3:
--Come si puo' conoscere l'home folder di un dato utente (eg, kilroy)?

--Domanda 4:
--Quale prodotto fumano in Microsoft?

Risposte:

Risposta [3]:

in Unix:
[C]
#include <pwd.h>
#include <sys/types.h>
struct passwd *pw= getpwnam('kilroy');
printf("kilroy's home dir is %s\n",pw->pw_dir);

[perl]
($name,$passwd,$uid,$gid,
    $quota,$comment,$gcos,$dir,$shell,$expire) = getpwnam('kilroy');
print "kilroy's home dir is: $dir\n";

in Win32:
[Microsoft] Risposta breve:
Non si puo', andate per tentativi. Buona fortuna.

[Microsoft] Risposta lunga - msdn:
[...]
There is usually no need for an application to know which user is logged in
or where in the file system that user's My Documents folder is located.
Instead, your application can retrieve the PIDL of the My Documents desktop
icon by calling the desktop's IShellFolder::ParseDisplayName method. The
parsing name used to identify the My Documents folder is not a file path but
is ::{450d8fba-ad25-11d0-98a8-0800361b1103}. The bracketed expression is the
text form of the My Documents GUID. For example, to retrieve the PIDL of My
Documents, your application should use:

hr = psfDeskTop->ParseDisplayName(NULL, NULL, 
    L"::{450d8fba-ad25-11d0-98a8-0800361b1103}", &chEaten, 
    &pidlDocFiles, NULL);

Once your application has the My Documents PIDL, it can handle the folder as
it would a normal file system folder. The Shell automatically maps changes
in My Documents or its subfolders to the appropriate file system folders.

If your application needs access to the actual file system folder that
contains the current user's documents, pass CSIDL_PERSONAL to
SHGetFolderLocation. The function returns the PIDL of the file system folder
that is displayed in the current user's My Documents folder.

HRESULT SHGetFolderLocation(HWND hwndOwner,int nFolder,HANDLE hToken,DWORD
dwReserved, LPITEMIDLIST *ppidl);

=======================

Risposta [4]:
Per sapere marca e fornitore, basta chiamare la funzione API:

HRESULT getSmokedPot(HWND hwnD, (void *)smokeStructPtr, CSIDL Smoker,HANDLE
hToken, LPMATCHES *matchbook);
passando, per Microsoft, CSIDL
Smoker=L"{af897645-6666666-11d-06perchichiamadafuoriroma-aa-bb-cc-msoft}"

Qualunque esso sia, e' sempre ottimo.

---

Cheers,
alf

<Prev in Thread] Current Thread [Next in Thread>
  • [Erlug] Della serie: programmazione base di sistema, domande 3 e 4, Alessandro Forghieri <=