Pages

Wednesday, October 5, 2011

Play MP3 with Powerbuilder


This is the tips how to play single MP3 file with Powerbuilder script

First, declare external function called mciSendStringW. This function originally is from winmm.dll file. When I tried this function, I'm using Windows XP with SP2.

1:  Public Function long mciSendStringW (string lpstrCommand, ref string lpstrReturnString, long uReturnLength, long hwndCallback) Library "winmm.dll"  

then use following script to run mp3 file,

1:  string ls_string  
2:  ls_string=space(500)  
3:    
4:  mcisendstringW("Play "+<your mp3 file including the path>,ls_string,len(ls_string),0)  

to stop the playback,

1:  mcisendstringW("Stop "+<your mp3 file including the path>,ls_string,len(ls_string),0)  

No comments:

Post a Comment