Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Media Player in VFP
Message
 
À
04/07/2008 08:11:46
Brian O'Donovan
Crescent Computers
Cork, Irlande
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Vista
Divers
Thread ID:
01328959
Message ID:
01329075
Vues:
57
Try this, I use this to play video files but it will work for music files also:
SELECT   ( YourTableName )

LOCAL lcVideoFile, lcWhereAmINow, lcWhatFilePicked
lcWhatFilePicked = ""

*************
**** local var to point to the folder I am at now
** to restore later
lcWhereAmINow = SYS(2003)

*** field used to hold your music selection into local variable
lcVideoFile = ALLTRIM(  MyMusicFileName )

*!*	****************
*!*	**** use windows scripting tools to find My documents folder
*!*	** then add variable together with MY VIDEOS to point
*!*	** automatically to this folder
*!*	loScripting = CREATEOBJECT('wscript.shell')
*!*	lcWhereDoIGo = loScripting.SpecialFolders("MyDocuments")
*!*	lcWhereDoIGo = lcWhereDoIGo + "\My Videos"

IF !EMPTY(lcVideoFile)
	DECLARE INTEGER ShellExecute IN shell32.DLL ;
		INTEGER hndWin, STRING cAction, STRING cFileName, ;
		STRING cParams, STRING cDir, INTEGER nShowWin


	ShellExecute(0,"open",(lcVideoFile),"","",1)

ELSE

LOCAL IcameFromThisFolder, lcWhereDoIGo, lcVideoFile
IcameFromThisFolder = SYS(2003)

	****************
	**** use windows scripting tools to find My documents folder
	** then add variable together with MY VIDEOS to point
	** automatically to this folder
	loScripting = CREATEOBJECT('wscript.shell')
	lcWhereDoIGo = loScripting.SpecialFolders("MyDocuments")
	lcWhereDoIGo = lcWhereDoIGo + "\My Videos"

	******
	*** now set the default to the My Videos folder so videos are easier to find
	SET DEFAULT TO (lcWhereDoIGo)

	*!* Prompt the user for the media file to open
	lcVideoFile = GETFILE("*.*|mpg|avi|wmv|mov|wav|mid","Select file to play")


	DECLARE INTEGER ShellExecute IN shell32.DLL ;
		INTEGER hndWin, STRING cAction, STRING cFileName, ;
		STRING cParams, STRING cDir, INTEGER nShowWin

	ShellExecute(0,"open",(lcVideoFile),"","",1)
	
ENDIF

* return to the folder we left before playing video
* this comes from variable in main.prg file
SET DEFAULT TO &defaultdir
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform