Lien .lnk
Anonyme
Comment obtenir la cible d'un lien(.lnk)
fAttribut ne retourne pas ce genre de d'information..

Contribution le : 10/06/2003 10:14
Créer un fichier PDF de la contribution Imprimer


Re: Lien .lnk
Stagiaire WDF
Inscrit:
24/05/2003 17:37
De Houdan
Post(s): 25
Voici un exemple tiré de MSDN. Je ne pense pas que cela soit adaptable pour WinDev :

PYT
//----
An application may need to access and manipulate a shortcut that was created previously. This operation is referred to as "resolving" the shortcut.

The application-defined ResolveIt function in the following example resolves a shortcut. Its parameters include a window handle, a pointer to the path of the shortcut, and the address of a buffer that receives the new path to the object. The window handle identifies the parent window for any message boxes that the shell may need to display. For example, the shell can display a message box if the link is on unshared media, if network problems occur, if the user needs to insert a floppy disk, and so on.

The ResolveIt function calls the CoCreateInstance function and assumes that the CoInitialize function has already been called. Note that ResolveIt needs to use the IPersistFile interface to store the link information. IPersistFile is implemented by the IShellLink object. The link information must be loaded before the path information is retrieved, which happens later in the example. Failing to load the link information causes the calls to the IShellLink::GetPath and IShellLink::GetDescription member functions to fail.

HRESULT ResolveIt(HWND hwnd, LPCSTR lpszLinkFile, LPSTR lpszPath)
{
HRESULT hres;
IShellLink* psl;
char szGotPath[MAX_PATH];
char szDescription[MAX_PATH];
WIN32_FIND_DATA wfd;

*lpszPath = 0; // assume failure

// Get a pointer to the IShellLink interface.
hres = CoCreateInstance(&CLSID_ShellLink, NULL,
CLSCTX_INPROC_SERVER, &IID_IShellLink, &psl);
if (SUCCEEDED(hres)) {
IPersistFile* ppf;


// Get a pointer to the IPersistFile interface.
hres = psl->lpVtbl->QueryInterface(psl, &IID_IPersistFile,
&ppf);
if (SUCCEEDED(hres)) {
WORD wsz[MAX_PATH];

// Ensure that the string is Unicode.
MultiByteToWideChar(CP_ACP, 0, lpszLinkFile, -1, wsz,
MAX_PATH);

// Load the shortcut.
hres = ppf->lpVtbl->Load(ppf, wsz, STGM_READ);
if (SUCCEEDED(hres)) {


// Resolve the link.
hres = psl->lpVtbl->Resolve(psl, hwnd, SLR_ANY_MATCH);
if (SUCCEEDED(hres)) {

// Get the path to the link target.
hres = psl->lpVtbl->GetPath(psl, szGotPath,
MAX_PATH, (WIN32_FIND_DATA *)&wfd,
SLGP_SHORTPATH );
if (!SUCCEEDED(hres)
HandleErr(hres); // application-defined function


// Get the description of the target.
hres = psl->lpVtbl->GetDescription(psl,
szDescription, MAX_PATH);
if (!SUCCEEDED(hres))
HandleErr(hres);
lstrcpy(lpszPath, szGotPath);
}
}
// Release the pointer to the IPersistFile interface.
ppf->lpVtbl->Release(ppf);
}
// Release the pointer to the IShellLink interface.

psl->lpVtbl->Release(psl);
}
return hres;
}


Contribution le : 10/06/2003 11:52
Créer un fichier PDF de la contribution Imprimer


Re: Lien .lnk
Anonyme
ARG, c'est psa imple ma foi !

Contribution le : 10/06/2003 11:56
Créer un fichier PDF de la contribution Imprimer


Re: Lien .lnk
Stagiaire WDF
Inscrit:
24/05/2003 17:37
De Houdan
Post(s): 25
Je regarde pour faire une DLL. Si cela fonctionnne, je la mets sur le site de WindevAsso.

PYT

Contribution le : 10/06/2003 12:29
Créer un fichier PDF de la contribution Imprimer


Re: Lien .lnk
Stagiaire WDF
Inscrit:
24/05/2003 17:37
De Houdan
Post(s): 25
Voila, j'ai envoyé un zip contenant une DLL et un exemple en WD55 ainsi que les sources à Windevasso.org

Si tu me donnes ton adresse email, je te l'envoie aussi.

PYT

Contribution le : 10/06/2003 13:26
Créer un fichier PDF de la contribution Imprimer


Re: Lien .lnk
Anonyme
voila mon mail :
fabien@iom.fr

et un grand merci

Contribution le : 10/06/2003 13:37
Créer un fichier PDF de la contribution Imprimer


Re: Lien .lnk
Animateur WDF
Inscrit:
26/06/2002 16:24
De wdforge.org
Post(s): 2822
Bonjour PYT,

TU peux aussi soumettre un téléchargement ici même :
soumettre

ps : si t'as pas d'espace web à ta disposition, poste nous le fichier on te retournera l'URL pour effectuer ta soumission.


Contribution le : 10/06/2003 15:04
_________________
R&B
Contact, CV.
Créer un fichier PDF de la contribution Imprimer



 Haut   Précédent   Suivant




Enregistrer votre réponse
CompteNom   Mot de passe   Authentification
Message:


Vous ne pouvez pas débuter de nouveaux sujets.
Vous pouvez voir les sujets.
Vous ne pouvez pas répondre aux contributions.
Vous ne pouvez pas éditer vos contributions.
Vous ne pouvez pas effacez vos contributions.
Vous ne pouvez pas ajouter de nouveaux sondages.
Vous ne pouvez pas voter en sondage.
Vous ne pouvez pas attacher des fichiers à vos contributions.
Vous ne pouvez pas poster sans approbation.

[Recherche avancée]


Connexion
Menu
Chercher WDForge
Chercher Web
Partenaires
Visualiser tous les Partenaires...
WinDev, WebDev, WinDev Mobile et HyperFile sont des marques déposées par PCSoft. |  Voter |  Legal |  Contact |   XOOPS 2.0.13.2