Newsgroup: it.comp.programmare.win32
Titolo: Icona sul Desktop

Salve a tutto il NG!
Che istruzioni devo inserire nel registro per visualizzare una icona sul
desktop che mi faccia un collegamento ad un cd-rom?
Grazie anticipatamente....
--
____________________________
   G 1 0 X®
Web: 
www.giox.net
Alt. Mail: 
info...@libero.it
Icq Uin: 47698601
Irc Chan. @azzurranet:
   #mhackerone; #ahccc; #linux;
_____________________________


Non penso che devi scrivere niente nel registro ma semplicemente
creare il file .lnk, da MSDN:
Creating a Shortcut to a File
The CreateLink sample function in the following example creates a
shortcut. The parameters include a pointer to the name of the file to
link to, a pointer to the name of the shortcut that you are creating,
and a pointer to the description of the link. The description consists
of the string, "Shortcut to file name," where file name is the name of
the file to link to. 
Because CreateLink calls theCoCreateInstance function, it is assumed
that theCoInitialize function has already been called. CreateLink uses
theIPersistFile interface to save the shortcut and the IShellLink
interface to store the file name and description. 
// CreateLink - uses the shell's IShellLink and IPersistFile
interfaces 
//   to create and store a shortcut to the specified object. 
// Returns the result of calling the member functions of the
interfaces. 
// lpszPathObj - address of a buffer containing the path of the
object. 
// lpszPathLink - address of a buffer containing the path where the 
//   shell link is to be stored. 
// lpszDesc - address of a buffer containing the description of the 
//   shell link. 
 
HRESULT CreateLink(LPCSTR lpszPathObj, 
    LPSTR lpszPathLink, LPSTR lpszDesc) 
{ 
    HRESULT hres; 
    IShellLink* psl; 
 
    // Get a pointer to the IShellLink interface. 
    hres = CoCreateInstance(&CLSID_ShellLink, NULL, 
        CLSCTX_INPROC_SERVER, &IID_IShellLink, &psl); 
    if (SUCCEEDED(hres)) { 
        IPersistFile* ppf; 
 
        // Set the path to the shortcut target and add the 
        // description. 
        psl->lpVtbl->SetPath(psl, lpszPathObj); 
        psl->lpVtbl->SetDescription(psl, lpszDesc); 
 
       // Query IShellLink for the IPersistFile interface for saving
the 
       // shortcut in persistent storage. 
        hres = psl->lpVtbl->QueryInterface(psl, &IID_IPersistFile, 
            &ppf); 
 
        if (SUCCEEDED(hres)) { 
            WORD wsz[MAX_PATH]; 
 
            // Ensure that the string is ANSI. 
            MultiByteToWideChar(CP_ACP, 0, lpszPathLink, -1, 
                wsz, MAX_PATH); 
 
            // Save the link by calling IPersistFile::Save. 
            hres = ppf->lpVtbl->Save(ppf, wsz, TRUE); 
            ppf->lpVtbl->Release(ppf); 
        } 
        psl->lpVtbl->Release(psl); 
    } 
    return hres; 
} 
Ma adesso mi sorge una domanda come ottengo la directory del Desktop?
E quella della cartella Documenti?
Ciao
Marco Barisione (ICQ 84277092)

 Marco Barisione (ICQ 84277092)
Dal Registro... esempio: cut&past
HRESULT PMUPDATE_API pmuGetSystemFolderPath(LPCSTR lpszFolder, LPSTR lpszPathLink, DWORD
lSize)
{
 HKEY  hKey;
LONG  lResult;
DWORD dwDisp;
lResult = RegCreateKeyEx(HKEY_CURRENT_USER,
       REGSTR_PATH_EXPLORER"\\Shell Folders",
       0,
       NULL,
       REG_OPTION_NON_VOLATILE,
       KEY_ALL_ACCESS,
       NULL,
       &hKey,
       &dwDisp);
if(lResult == ERROR_SUCCESS)
 {
 lResult = RegQueryValueEx(hKey, lpszFolder, NULL, NULL, (LPBYTE) lpszPathLink, &lSize);
 RegCloseKey(hKey);
 return lResult==ERROR_SUCCESS;
 }
return FALSE;
}
per le opzioni da mettere in lpszFolder da chiedere guarda quelle che ci sono nel tuo
registro
alla chiave
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
tipo: "Desktop","Programs","Personal","Start Menu" e cosě via...