![]() |
|
[VB.NET]Using COM Controls - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Visual Basic & .NET Framework (https://sinister.li/Forum-Visual-Basic-NET-Framework) +--- Thread: [VB.NET]Using COM Controls (/Thread-VB-NET-Using-COM-Controls) |
[VB.NET]Using COM Controls - 1234hotmaster - 07-01-2011 Windows Media Player
[altimg=http://i.min.us/ib2QDi.png]Windows Media Player in VB[/altimg] Info: You can play Videos or Music in your program visible or hidden with this control. Usage Example: Step 1 - Open Visual Studio Step 2 - Open Toolbox ( Ctrl + Alt + X ) Step 3 - Right click on "All Windows Forms" and click "Add Tab" Step 4 - Right click on the new tab and select "Chose Items" Step 5 - Go to the COM tab and scroll down for "Windows Media Player" and tick it. Step 6 - Select the control from the new tab and left click it on your form Step 7 - Resize it or set its "Dock" property to "Fill" Step 8 - Create a button on the empty part of the control with the text "Load" Step 9 - Double click that button and copy paste this code: Code: Dim ofd as new OpenFileDialog
ofd.Filter = "AVI Video Files (*.avi)|*.avi|MPG Video Files (*.mpg*)|*.mpg|MPEG Video Files (*.mpeg)|*.mpeg|Music Files (*.mp3 *.wav)|*.mp3;*.wav|MP4 Files (*.mp4)|*.mp4"
If ofd.ShowDialog = DialogResult.OK Then AxWindowsMediaPlayer1.URL = ofd.FileNameStep 10 - Create a new button on the empty part of the control with the text "Full Screen" Step 11 - Double click that button and copy paste this code: Code: AxWindowsMediaPlayer1.fullScreen = TrueStep 12 - You must always have both of these two libraries in the same folder as the program to make it work: [1]AxInterop.WMPLib.dll [2]Interop.WMPLib.dll Old Style Progressbar
[altimg=http://i.min.us/idJJZE.gif]Old ProgressBar Standard[/altimg] [altimg=http://i.min.us/ib2wNi.gif]Old ProgressBar Smoth[/altimg] Usage Example: Step 1 - Open Visual Studio Step 2 - Open Toolbox ( Ctrl + Alt + X ) Step 3 - Right click on "All Windows Forms" and click "Add Tab" Step 4 - Right click on the new tab and select "Chose Items" Step 5 - Download [link=http://uppit.com/5md6mdbv50e3/MSCOMCTL.OCX]This[/link] OCX file ( MSCOMCTL.OCX ) Step 6 - Go to the COM tab Step 7 - Click "Browse" and select the OCX you just downloaded then scroll down and tick "Microsoft ProgressBar Control 6.0 (SP4)" Step 8 - Go to your new tab and select your control and left click on your form Step 9 - Add a Timer with "100" "Interval" and set its "Enabled" to "True" in the properties Step 10 - Double click that new timer and copy paste this code: Code: If AxProgressBar1.Value >= 100 Then AxProgressBar1.Value = 0
AxProgressBar1.Value += 1Step 11 - You must always have this library in the same folder as the program to make it work: [1]MSCOMCTL.OCX Adobe Flash Player
[altimg=http://i.min.us/ib6NHY.png]Shockwave flash player in VB[/altimg] Info: You can open and view (*.swf) files in your program even if the user does not have flash player installed Usage Example: Step 1 - Open Visual Studio Step 2 - Open Toolbox ( Ctrl + Alt + X ) Step 3 - Right click on "All Windows Forms" and click "Add Tab" Step 4 - Right click on the new tab and select "Chose Items" Step 5 - Download [link=http://uppit.com/4kfnx9606xdd/Flash10h.ocx]This[/link] OCX file ( Flash10h.ocx ) Step 6 - Go to the COM tab Step 7 - Click "Browse" and select the OCX you just downloaded then scroll down and tick "Shockwave Flash Object" Step 8 - Go to your new tab and select the new control and left click on the form Step 9 - Create a button with the text "Play" then double click it and copy paste this code: Code: Dim ofd As New OpenFileDialog
ofd.Filter = "Flash Files (*.swf)|*.swf"
If ofd.ShowDialog = DialogResult.OK Then AxShockwaveFlash1.LoadMovie(0, ofd.FileName)Step 10 - You must always have this library in the same folder as the program to make it work: [1]Flash10h.ocx |