Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create a shortcut
Message
 
To
13/05/2002 15:26:41
Emerson Reed
Folhamatic Tecnologia Em Sistemas
Americana - São Paulo, Brazil
General information
Forum:
Visual FoxPro
Category:
Installation, Setup and Configuration
Miscellaneous
Thread ID:
00654108
Message ID:
00655837
Views:
19
>Hi, here is the code...
>
>
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
>   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
>            llresult = (SetLinkIconFile(0, @lclinkfile, @lciconfile, lnindex) = 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
>      SET DEFAULT TO (m.PATH_DEF)
>   ELSE
>      MESSAGEBOX("Desktop folder não encontrada!",16,"ERRO")
>   ENDIF
>
>   CLEAR DLLS
>
>   RETURN
>ENDFUNC
>
>Emerson Santon Reed
>emerson@folhamatic.com.br

I misunderstood your original post. 53 is the correct value. Just to make this a bit more readable for both of us, I've added the necessary HTML tags. Where exactly is the -3 value being returned? It looks like there are at least two places where it could occur.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform