Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Exe file not working in Windows 7 but works in XP
Message
De
14/11/2016 11:59:27
 
 
À
12/11/2016 16:53:38
Sonny Tabano
Trams Printwork, Inc.
Mabalacat, Philippines
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Divers
Thread ID:
01643258
Message ID:
01643388
Vues:
61
Have you tried taking a look at the value of some of the local variables (e.g. lcCurrentDir) to make sure they contain the expected values? Although one might expect the expression
SYS(5)+SYS(2003)
to contain the directory where the EXE is located, or the directory specified as the "Start in" entry in the shortcut properties, it's not always guaranteed to be the case. I've seen on occasion the path returned is that of the location of the FoxPro runtime library. Other times -- especially if some sort of API call was performed, the directory returned would point to one of the Windows system directories. If you've called a FindFile() or similar function, it may point to the last directory selected in the dialog.

BTW, you really don't need to be using macros in your code. For example
oDstFolder = oShell.NameSpace("&lcCurrentDir"+"\datafile")
could be written as:
oDstFolder = oShell.NameSpace(m.lcCurrentDir+"\datafile")
>Hi everyone,
>
>I have this code in a form that copies files from backup folder/file using Shell.Application. When I run the form in VFP before compiling it into Exe file it does as expected copying the files.But when compiled into an exe file and run in Windows 7 it doesn't work., Same Exe file runs in Windows XP.
>Any idea why it works when run in VFP and not when after its been compiled to an Exe file and run in Windows 7, but works in Window XP?
>
>Any idea would be greatly appreciated
>
>Thanks,
>
>Sonny
>
>
>
>
>LOCAL lcDirPath, lcCurrentDir, oShell,  oDstFolder
>Do while .T.
>   With ThisForm
>	lcCurrentDir  = ALLTRIM(SYS(5))+ALLTRIM(SYS(2003))
>        lcDirPath     = ALLTRIM(.txtDirPath.Value)
>        IF EMPTY(.txtDirPath.Value)
>            Messagebox("Directory Pathname is Empty",0+16,"Invalid Entry")
>            Exit
>        ENDIF
>        IF .NOT. DIRECTORY(.txtDirPath.Value)
>            Messagebox("Directory Pathname Not Found!",0+16,"Invalid Entry")
>            Exit
>        ENDIF
>        SET SAFETY OFF
>	oShell = CREATEOBJECT("Shell.Application")
>	oDstFolder = oShell.NameSpace("&lcCurrentDir"+"\datafile")
>	IF VARTYPE(oDstFolder)="O"
>	     oDstFolder.CopyHere("&lcDirPath"+"\*.*")
>	ENDIF
>        SET SAFETY On  
>       Exit
>Enddo
>
>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform