-
dvd player
DVD Players can cost lots of money these days (well for the members here they are free) but other ppl have to pay so heres my tut on how to make a standard DVD Player.
1. Open a Stanard Exe, and add Six command buttons. (You can also add these as a menu, if buttons aren't your thing)
2. Name them the following:
Code:
cmdPlay
cmdPause
cmdStop
cmdNextChapter
cmdPreviousChapter
cmdReplay3. Here is the code that goes into each:
Code:
Private Sub cmdNextChapter_Click()
form1.DVD1.PlayNextChapter
End Sub
Private Sub cmdPause_Click()
form1.DVD1.Pause
End Sub
Private Sub cmdPlay_Click()
form1.DVD1.Play
End Sub
Private Sub cmdPrevious_Click()
form1.DVD1.PlayPrevChapter
End Sub
Private Sub cmdReplay_Click()
form1.DVD1.ReplayChapter
End Sub
Private Sub cmdStop_Click()
form1.DVD1.Stop
End Sub4. It's time to add the DVD component. Press Ctrl-T to pop up the Components window, and select MSWEBDVD Type 1.0 Library. Check it and click OK.
5. You will now see two new items added on the side menu. Click on MSWebDVD, and make a DVD control in your form. Make it big enough to view a DVD. (You can always have a "Full Screen" option later) Call it DVD1
6. And that's about it. Go ahead.
(P.S. You need a DVD Rom on your computer to work )
~Extra~
1. Full screen Mode
1a. Make a new Commandbutton and name it "cmdfull" without the "
1b. Now double click on it and your see the code box pop up and than paste this code in to it.
Code:
Private Sub cmdfull_Click()
DVD1.FullScreenMode = True
End Sub1c. Now your done!
2 Limited Uses (you can use this if u want to release a beta or a demo for your dvd player or program)
2a. add a label, leave the name "Label1", this label is only for this tutorial really, I've only added it so you can clock and see the amount of times, aka debugging purposes.
Next you will need to add this coding.
Code:
Private Sub Form_Load()
Dim times As Integer
times = GetSetting(App.EXEName, "Open", "times", "0")
times = times + 1
Label1.Caption = times
If times > 10 Then
Me.Hide
MsgBox "You have used this program 10 times already and you are not allowed to use it any more", vbInformation, "Sorry"
End
Else
MsgBox "You have used this program " & times & "times, please enjoy"
End If
SaveSetting App.EXEName, "Open", "times", Label1.Caption
End Sub2b. if you want the limit to be more than 10 change the "10" to what ever amount you want.
2c. After using this alot, your registry would be full up..I suggest you add a delete function to your programs so you dont carry on having obsolete keys. Add this code into that coding above.
Code:
DeleteSetting App.EXEName3. Adding Driver open and close buttons.
3a. create two command buttons , (I called mine cdopen and cdclose) set the captions to something like "Open" and "Close" . Ok now double click on the open button for the code viewer box to pop up and add this code:
Code:
mciSendString "set cdaudio door open", 0, 0, 0now add this to the Close button:
Code:
mciSendString "set cdaudio door closed", 0, 0, 0Ok , now thats done open up the code window and click right at the top (The declarations bit) and add this code:
Code:
Option Explicit
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As LongNow you got youself a DVD Player!