Réponse acceptée !
pas d'url, mais une réponse, la fonction que j'appelle pour créer des lnk.
par exemple ici ds le menu démarer.
#include <shlobj.h>
HRESULT createStartMenuShortcut(LPCTSTR lpszStartMenuFolder
, LPCTSTR lpszShortcutFile
, LPCTSTR lpszDescription
, LPCTSTR lpszArgs
, LPCTSTR lpszRelativeFolder
, OUT LPSTR lpszLnkFName
, int nMaxLnkFNameLength)
{
// find the current user's Start Menu Programs folder
HRESULT hr=NULL;
TCHAR szLink[_MAX_PATH];
ZeroMemory(szLink, _countof(szLink));
_tcscpy(szLink, lpszStartMenuFolder);
// proceed to create the shortcut
IShellLink*pIShellLink=NULL;
IPersistFile*ppf=NULL;
WCHAR pLinkUnicode[_MAX_PATH];
CoInitialize(NULL);
// get a pointer to the IShellLink interface.
hr=CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&pIShellLink);
if(SUCCEEDED(hr))
{
// get a pointer to IPersistFile interface for saving shortcut
hr=pIShellLink->QueryInterface(IID_IPersistFile, (void**)&ppf);
if(SUCCEEDED(hr))
{
hr=pIShellLink->SetPath(lpszShortcutFile);
hr=pIShellLink->SetDescription(lpszDescription);
hr=pIShellLink->SetArguments(lpszArgs);
if(SUCCEEDED(hr))
{
// add the target folder to the Start Menu Programs path
lstrcat(szLink, _T("\\"));
lstrcat(szLink, lpszRelativeFolder);
lstrcat(szLink, _T("\\"));
// create the directory if it does not exist
CreateDirectory(szLink, NULL);
// add the file name for the shortcut
lstrcat(szLink, lpszDescription);
lstrcat(szLink, _T(".lnk"));
if(lpszLnkFName && nMaxLnkFNameLength > 0)
lstrcpyn(lpszLnkFName, szLink, nMaxLnkFNameLength);
// convert string to Unicode, and call IPersistFile::Save()
MultiByteToWideChar(CP_ACP, 0, szLink, -1, pLinkUnicode, _MAX_PATH);
hr=ppf->Save(pLinkUnicode, TRUE);
}
ppf->Release();
}
pIShellLink->Release();
}
CoUninitialize();
return hr;
}
___________________________________________________________
MagicalementNono 