>CreateShortCut("D:\EFISCAL\EFISCAL.EXE","E-FISCAL")
>
>FUNCTION CreateShortCut(MEXE,MNOME)
>
> DECLARE INTEGER CreateShellLink IN LNKFILES.DLL;
> STRING @lpzLinkFileName, STRING @lpzExeFileName
>
> DECLARE INTEGER FindDesktopFolder IN LNKFILES.DLL;
> INTEGER hOwner, STRING @lpbuffer
>
> DECLARE INTEGER FindProgramFolder IN LNKFILES.DLL;
> INTEGER hOwner, STRING @lpbuffer
>
> DECLARE INTEGER SetLinkIconFile IN LNKFILES.DLL;
> INTEGER HWND, STRING @lpszLinkName,;
> STRING @lpszPath, INTEGER iIconIndex
>
> DECLARE INTEGER SetLinkWorkDir IN LNKFILES.DLL;
> INTEGER HWND, STRING @lpszLinkName, STRING @lpszPath
>
> LOCAL lcbuffer, lnresult, lcdesktop
> LOCAL lclinkfile, lcexefile
> LOCAL lciconfile, lnindex, llresult
> LOCAL lcpath
> lcbuffer = SPACE(260)
> lnresult = FindDesktopFolder(0, @lcbuffer)
> * lnresult is returning 53 (really, this is the return value!)
> lcdesktop = LEFT(lcbuffer, lnresult)
> * lcdesktop is returning
> * "C:\Documents and Settings\Emerson Santon Reed\Desktop"
> IF !EMPTY(lcdesktop)
> lclinkfile = ADDBS(lcdesktop) + MNOME + ".LNK"
> lcexefile = MEXE
> lnresult = 1
> IF !FILE(lclinkfile)
> * FILE() is always returning .F.
> lnresult = CreateShellLink(@lclinkfile, @lcexefile)
> ENDIF
> IF lnresult==0
> IF !("FOLHAWIN"$MEXE)
> lciconfile = ADDBS(JUSTPATH(MEXE))+JUSTFNAME(JUSTPATH(MEXE)+".ICO")
> lnindex = 0
> lnresult = SetLinkIconFile(0, @lclinkfile, @lciconfile, lnindex)
> * Here lnresult is -3
> llresult = (lnresult = 0)
> IF !llresult
> MESSAGEBOX("Impossível atribuir ícone!",16,"ERRO")
> ENDIF
> ENDIF
> lcpath = JUSTPATH(MEXE)
> llresult = (SetLinkWorkDir(0, @lclinkfile, @lcpath) = 0)
> IF !llresult
> MESSAGEBOX("Impossível configurar"+CHR(13)+"diretório de trabalho",16,"ERRO")
> ENDIF
> ELSE
> MESSAGEBOX("Impossível criar atalho!",16,"ERRO")
> ENDIF
> ELSE
> MESSAGEBOX("Desktop folder não encontrada!",16,"ERRO")
> ENDIF
>
> CLEAR DLLS
>
> RETURN
>ENDFUNC
>
>Forgive me...
Nothing to forgive. I've can't re-call the last time I tried to use the function with a regular icon file instead of the executable. I do some testing and get back with you.
Oh, BTW, is the icon set correctly?
George
Ubi caritas et amor, deus ibi est