Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Media Player in VFP
Message
 
To
04/07/2008 08:11:46
Brian O'Donovan
Crescent Computers
Cork, Ireland
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Vista
Miscellaneous
Thread ID:
01328959
Message ID:
01329075
Views:
56
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform