Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to know the path of an EXE or file type
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00336658
Message ID:
00337364
Vues:
12
>Hi,
>
>How can I know the path where an app runs? ie: if a user changes the destination path of an Excel or Word app.
>
>I think is via the registry but don't know how?

Pablo,

Creo que esta Función que debemos a George Tasker te será de aluguna ayuda. De paso te cuento que he tenido mas suerte que tu en el 156, aprobe con 777.

José
************************************************************
*  FUNCTION IsWordThere()
************************************************************
*  Author............: José Constant
*  Project...........: Infodons
*  Created...........: 08/04/99  18:43:55
*  Copyright.........: (c) Constant Software Systems, 1999
*  Compiler..........: Visual FoxPro 05.00.00.0415 for Windows
*) Description.......: Checks if Word is installed on the User PC
*)                   : Based on a solution by George Tasker on the UT
*)                   : Subject title 'More Fun with Excel OLE'
*)                   : Posted April 7, 1999.
*)                   : Assumes that FoxTools is loaded (VFP5)
*  Calling Samples...: IF IsWordThere()
*                    :   Do your thing
*                    : ENDIF
*  Parameter List....:
*  Major change list.:

Function iswordthere()
  Local lnerrfile, ;
    lcfile, ;
    lcpath, ;
    lcresult, ;
    lnresult, ;
    lnretval

  *-- Create a DUMMY.DOC file
  lnerrfile = FCREATE("DUMMY.DOC")
  If lnerrfile < 0
    errormsg( cannottestforword_loc)
  Else
    Fclose(lnerrfile )	  && Close file

    *-- find the app associated with it
    Declare INTEGER FindExecutable IN SHELL32;
      STRING @lcFile, ;
      STRING @lcPath, ;
      STRING @lcResult

    lcfile = "DUMMY.DOC"
    lcpath = JUSTPATH( FULLPATH( lcfile))
    lcresult = SPACE( 260)

    lnresult = FindExecutable( @lcfile, @lcpath, @lcresult)

    Do CASE
      Case lnresult = 31
        *-- no application associated with that file
        errormsg( wordnotonthispc_loc)
      Case lnresult > 32
        If "WINWORD" $ UPPER( lcresult)
          lnretval = .T.
        Else
          errormsg( wordnotonthispc_loc)
        Endif
      Otherwise
        errormsg( wordnotonthispc_loc)
    Endcase
    Delete FILE dummy.DOC
  Endif

  Return lnretval
Endfunc
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform