Play background music
statement:
DeclareFunctionMCISendString&Lib"MMSYSTEM"(ByValLPSTRCOMMAND$,ByValLPSTRRETURNSTRAsAny,ByValWRETURNLEN%,ByValHCALLBACK%)
Start playing:
R%=MCISendString&(″OPENEXAMPLE.MIDTYPESEQUENCERALIASNN″,0&,0,0)
R%=MCISendString&(″PLAYNNFROM0″,0&,0,0)
R%=MCISendString&("CLOSEANIMATION",0&,0,0)
stop:
R%=MCISendString&(″OPENEXAMPLE.MIDTYPESEQUENCERALIASNN″,0&,0,0)
R%=MCISendString&("STOPNN",0&,0,0)
R%=MCISendString&("CLOSEANIMATION",0&,0,0)
Among them, EXAMPLE.MID is the file to be played, and NN is the custom name mark.
Make XMPlayer automatically play VCD
XingMPEGPlayer is an excellent software for soft decompression and playing VCD, but a series of operations such as loading XM-player, entering the playback state, and hiding the panel require multiple clicks of the mouse, which is more troublesome. Next, use the VB program to first check whether the optical drive is ready or whether there is a VCD disc in the optical drive, and then use VB to simulate XingMPEG's keyboard actions and realize the automatic playback of the VCD disc through just a few lines of programs.
1. Enter the VB environment, set the Visible property of the form Form1 to False, then create a drive list box Drivel on the form, and set its Visible property to False so that the form and list box will not be loaded when the program is loaded. Show it. All other properties take default values.
2. Double-click the form and write process code
PRivateSubForm—Load()
OnErrorGoTofindinder' checks whether the optical drive is ready or whether there is a VCD disc in the optical drive
startline:
drvnmb=Drive1ListCount
cdname$=Drive1List(drvnmb-1)
files$=Dir$(cdname$&″/mpegav/*.dat″)
Iffiles$=”″ThenGoTofindinder
act=Shell("C:/ProgramFiles/Xmplayer/XMPLAYER.EXE", 1)
'Assuming Xmplayer is located in this directory, open it and give it focus
SendKeys "% (fv)", True' simulates Ctrl+fv keyboard action and starts playing VCD
PauseTime=2′ Some VCD discs will be prompted with some errors before playing due to irregular production. In order to deal with these errors, a pause is performed for a few seconds. This pause is performed in the background and does not affect the normal continuous playback of VCDs.
start=Timer
DoWhileTimer<start+PauseTime
Loop
SendKeys″{enter}, ^s, ^p, ^{f4}, %{esc}, ^4″, True′ simulates other keyboard actions, full screen playback, hidden panels, etc.
End
finderr:
msg$=”The optical drive is not ready, or there is a non-VCD disc in the optical drive. Prepare the optical drive.”
msg$=msg$&"Or change a CD, then press Enter to try again, or press Cancel to exit"
er=MsgBox(msg$,53,"Error message")
Ifer=4ThenResumestartlineElseEn′ The user chooses to retry or exit
EndSub
3. Compile the above program into an EXE file, then drag its shortcut to the desktop. Double-click the icon to load XingMPEG Player and automatically start playing VCD on the full screen. At the same time, set the PLAYER panel to the StandardBar state and hide it. In the program, ^ means Ctrl, and % means Alt. The reason why the two actions of pausing "^S" and playing "^P" must be inserted continuously in the program is because version 2.0 of the VCD starts playing after pressing Alt+FV, and version 1.0 also requires pressing Ctrl+P after pressing Alt+FV. , and Ctrl+P is equivalent to Ctrl+S (i.e. pause ); so if there is only one "^P", VCD10 will start playing and VCD20 will pause. In order to take into account the two versions of VCD, first simulate the Ctrl+S action to pause, and then simulate Ctrl+P to start playing, thus making the two versions All VCDs can be played automatically after executing this program.
The above program has been debugged in Pwin95, VB5 and XingMPEGPlayer3.2 environments. ->