Six
Guru
- Joined
- Jan 21, 2007
- Sythe Gold
- 12
- Messages
- 1,482
All my tutorials Compiled into 1 post. I might think of writing more so if you need a tut on something tell me.
Contents:
-MP3 Player
-Simple WebBrowser Functions
-Taking a screenshot of just the project/client
-do something if a key is pressed
-Random background colors
MP3 Player
ok for this tut we will need the windows media player componet
project>componets>windows media player
ok now after u have that simple add it to ur form name it "WindowsMediaPlayer1"
also ull need the common dialog componet
project>componets>microsoft common dialog 6.0
make it on ur form and call it "Common"
ok now for the browse button make a command button.
put this code
ok now for an added effect i put Text1.Text = Common.FileName so in text1 people will know wut song there playing
so make sure u add Text1 were ever u want
ok now u can either use the Windows media player to control the playing stop and pause or u can make it visible to false and add a play and stop button
for these codes u can use
to play
and to stop
there is other methods but u can experiment
umm heres the source code:
http://www.ezupload.org/?w=download&id=8964&name=Mp3_Player.rar
Simple WebBrowser Functions
well this is VERY basic but heres for noobs..
to stop a browser (also used in mute loading music)
to go refresh
to go to your set search engine
to go forward
to go back
to go to Home (site you set in IE)
easy huh?
ok now if you want a text box at the bottom of the screen that says what site you are currently on add this
Text2.Text will show wut site ur on
ok now to make a URL imput
add a textbox called Text1.Text
then add a command button called Command1
now add this
o wow that was cool
fully working webbrowser
ok heres some more stuff
say i want to make a google search bar
add a text box called Text3.Text and also a command2 button
ok now for my command button code
now when u click command2 it will search google to what ever is in text3
heres some more if you wanna use multiple or more search engins
Yahoo
InfoSeek
AltaVista
Lycos
ok now for resizing (so when maximize your browser also goes bigger)
ok so just add this
you should know were to put that..
also to remove errors on moving back and refreshing and shit you can add
before your code
Screenshot of Just the client
ok this is taken from r-legit so give props to whom made it
but ill explain how to add it
make a timer and call it "scrshot"
now add this code
(make the timer interval 1000)
ok this will save it in the folder with the program now also it saves the screenshot with a nubmer so lets declare "scrnum"
at the top of the code add
now
add a modul and put this in there
opps forgot this add this into your form
ok now make an image and call it "Screenshot" and make it visible to false..doesnt mater how big the picture is..
hope i didnt forget anything
Do something if a key is pressed
ok say your makign a webbrowser and you want to be able to type in a site and push enter and it goes to that site
simple use this code
clicks command1 if enter is pressed in Text1
Random BG Colors
ok say your makign a webbrowser and you want to be able to type in a site and push enter and it goes to that site
simple use this code
clicks command1 if enter is pressed in Text1
Contents:
-MP3 Player
-Simple WebBrowser Functions
-Taking a screenshot of just the project/client
-do something if a key is pressed
-Random background colors
MP3 Player
ok for this tut we will need the windows media player componet
project>componets>windows media player
ok now after u have that simple add it to ur form name it "WindowsMediaPlayer1"
also ull need the common dialog componet
project>componets>microsoft common dialog 6.0
make it on ur form and call it "Common"
ok now for the browse button make a command button.
put this code
Code:
Dim fnum As Integer
Common.CancelError = True
Common.FileName = ""
Common.InitDir = "C:\"
Common.Flags = cdlOFNFileMustExist
Common.Filter = "Mp3|*.mp3|All|*.*"
' comdia.Flags = &H4
Common.ShowOpen
WindowsMediaPlayer1.URL = Common.FileName
Text1.Text = Common.FileName
Exit Sub
ok now for an added effect i put Text1.Text = Common.FileName so in text1 people will know wut song there playing
so make sure u add Text1 were ever u want
ok now u can either use the Windows media player to control the playing stop and pause or u can make it visible to false and add a play and stop button
for these codes u can use
to play
Code:
WindowsMediaPlayer1.URL = Text1.Text
and to stop
Code:
WindowsMediaPlayer1.URL = ""
there is other methods but u can experiment
umm heres the source code:
http://www.ezupload.org/?w=download&id=8964&name=Mp3_Player.rar
Simple WebBrowser Functions
well this is VERY basic but heres for noobs..
to stop a browser (also used in mute loading music)
Code:
WebBrowser1.stop
to go refresh
Code:
WebBrowser1.refresh
to go to your set search engine
Code:
Webbrowser1.gosearch
to go forward
Code:
WebBrowser1.GoForward
to go back
Code:
WebBrowser1.Goback
to go to Home (site you set in IE)
Code:
WebBrowser1.GoHome
easy huh?
ok now if you want a text box at the bottom of the screen that says what site you are currently on add this
Code:
Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
Text2.Text = (WebBrowser1.LocationURL)
End Sub
Text2.Text will show wut site ur on
ok now to make a URL imput
add a textbox called Text1.Text
then add a command button called Command1
now add this
Code:
Private Sub Command1_Click()
WebBrowser1.Navigate Text1.Text
o wow that was cool
fully working webbrowser
ok heres some more stuff
say i want to make a google search bar
add a text box called Text3.Text and also a command2 button
ok now for my command button code
Code:
WebBrowser1.Navigate "http://www.google.com/search?hl=en&q=" & Text3.Text & "&btnG=Google+Search
now when u click command2 it will search google to what ever is in text3
heres some more if you wanna use multiple or more search engins
Yahoo
Code:
WebBrowser1.Navigate "http://search.yahoo.com/search?p=" & Text3.Text & "&sm=Yahoo%21+Search&fr=FP-tab-web-t&toggle=1&cop=&ei=UTF-8"
InfoSeek
Code:
WebBrowser1.Navigate "http://infoseek.go.com/Titles?qt=" & Text3.Text & "&col=WW&sv=IS&lk=noframes&svx=home_searchbox"
AltaVista
Code:
WebBrowser1.Navigate "http://www.altavista.com/web/results?itag=ody&q=" & Text3.Text & "&kgs=1&kls=0"
Lycos
Code:
WebBrowser1.Navigate "http://search.lycos.com/default.asp?loc=searchbox&tab=web&query=" & Text3.Text & "&submit.x=0&submit.y=0&submit=image
ok now for resizing (so when maximize your browser also goes bigger)
ok so just add this
Code:
WebBrowser1.Move 0, 840, ScaleWidth, ScaleHeight - 840
you should know were to put that..
also to remove errors on moving back and refreshing and shit you can add
Code:
On Error Resume Next
before your code
Screenshot of Just the client
ok this is taken from r-legit so give props to whom made it
but ill explain how to add it
make a timer and call it "scrshot"
now add this code
(make the timer interval 1000)
Code:
Private Sub scrshot_Timer()
If GetAsyncKeyState(vbKeyF12) Then
CopyToClipboard
Screenshot.Picture = Clipboard.GetData
SavePicture Screenshot.Picture, App.Path & "\Screenshot - " & scrnum & ".bmp"
scrnum = scrnum + 1
End If
DoEvents
End Sub
ok this will save it in the folder with the program now also it saves the screenshot with a nubmer so lets declare "scrnum"
at the top of the code add
Code:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
dim scrnum as integer
now
add a modul and put this in there
Code:
Public Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long
Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Function CopyToClipboard()
Dim alt_scan_code As Long
alt_scan_code = MapVirtualKey(&H12, 0)
keybd_event &H12, alt_scan_code, 0, 0
DoEvents
keybd_event &H2C, 0, 0, 0
DoEvents
keybd_event &H12, alt_scan_code, &H2, 0
DoEvents
End Function
opps forgot this add this into your form
ok now make an image and call it "Screenshot" and make it visible to false..doesnt mater how big the picture is..
hope i didnt forget anything
Code:
Private Sub Form_Load()
scrnum = 0
End Sub
Do something if a key is pressed
ok say your makign a webbrowser and you want to be able to type in a site and push enter and it goes to that site
simple use this code
Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
command1_Click
End If
End Sub
clicks command1 if enter is pressed in Text1
Random BG Colors
ok say your makign a webbrowser and you want to be able to type in a site and push enter and it goes to that site
simple use this code
Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
command1_Click
End If
End Sub
clicks command1 if enter is pressed in Text1

