Sunday, February 21, 2016

Some Basic Programmings Of VB 6.0

Tic Tac Teo:

' Program for tic tac toe Human vs human

Dim cross(8) As Boolean
Dim ball(8) As Boolean
Dim m As Integer
Dim player As Integer


Sub check_status()
If ball(0) = True And ball(1) = True And ball(2) = True Then
Line10.Visible = True
End If
If ball(3) = True And ball(4) = True And ball(5) = True Then
Line9.Visible = True
End If
If ball(6) = True And ball(7) = True And ball(8) = True Then
Line8.Visible = True
End If
If ball(0) = True And ball(3) = True And ball(6) = True Then
Line5.Visible = True
End If

If ball(1) = True And ball(4) = True And ball(7) = True Then
Line6.Visible = True
End If
If ball(2) = True And ball(5) = True And ball(8) = True Then
Line7.Visible = True
End If
If ball(0) = True And ball(4) = True And ball(8) = True Then
Line12.Visible = True
End If
If ball(2) = True And ball(4) = True And ball(6) = True Then
Line11.Visible = True
End If

If cross(0) = True And cross(1) = True And cross(2) = True Then
Line10.Visible = True
End If
If cross(3) = True And cross(4) = True And cross(5) = True Then
Line9.Visible = True
End If
If cross(6) = True And cross(7) = True And cross(8) = True Then
Line8.Visible = True
End If
If cross(0) = True And cross(3) = True And cross(6) = True Then
Line5.Visible = True
End If

If cross(1) = True And cross(4) = True And cross(7) = True Then
Line6.Visible = True
End If
If cross(2) = True And cross(5) = True And cross(8) = True Then
Line7.Visible = True
End If
If cross(0) = True And cross(4) = True And cross(8) = True Then
Line12.Visible = True
End If
If cross(2) = True And cross(4) = True And cross(6) = True Then
Line11.Visible = True
End If
End Sub

Sub check_position()

For m = 0 To 8


If Image1(m).Picture = Image2.Picture Then
ball(m) = True

Else: ball(m) = False
End If

If Image1(m).Picture = Image3.Picture Then
cross(m) = True
Else

cross(m) = False

End If
Next

End Sub
Private Sub Image1_Click(Index As Integer)
check_position

If player = 1 And cross(Index) = False And ball(Index) = False Then
Image1(Index).Picture = Image2.Picture
End If
If player = 2 And cross(Index) = False And ball(Index) = False Then
Image1(Index).Picture = Image3.Picture
End If


check_position
check_status

End Sub



Private Sub Image2_Click()
player = 1
End Sub

Private Sub Image3_Click()
player = 2
End Sub



Private Sub mnuNew_Click()
For m = 0 To 8
Image1(m).Picture = LoadPicture("")
Next
Line5.Visible = False
Line6.Visible = False
Line7.Visible = False
Line8.Visible = False
Line9.Visible = False
Line10.Visible = False
Line11.Visible = False
Line12.Visible = False
End SubSub


Output:


Snake and Ladder:


'Snake and ladder program

Option Base 1
Dim c(10) As Variant
Dim r(10) As Variant

Dim x As Integer
Dim m As Integer
Dim n As Integer
Dim num As Integer
Dim totalnum As Single
Dim totalnum1 As Single
Dim player As Integer
Dim t As Integer


Private Sub Command2_Click()
'To move the chess pieces to the original position
Image1(0).Move 10200, 5520
Image1(1).Move 10200, 6480
totalnum = 0
totalnum1 = 0
Label2.Caption = ""
MMControl1.Command = "close"
End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Form_Load()
' To assign the column and row coordinates to all the boxes

c(1) = 600
r(1) = 8200
For i = 1 To 9
c(i + 1) = c(i) + 800

Next
For j = 1 To 9
r(j + 1) = r(j) - 800
Next
End Sub


'To initiate the rolling of dice
Private Sub roll()
x = x + 10
Randomize Timer
n = Int(1 + Rnd * 6)
For i = 0 To 6
Shape1(i).Visible = False
Next
If n = 1 Then
Shape1(3).Visible = True
Shape2.FillColor = &HC0C0C0

End If
If n = 2 Then
Shape1(2).Visible = True
Shape1(4).Visible = True
Shape2.FillColor = &H8080FF
End If
If n = 3 Then
Shape1(2).Visible = True
Shape1(3).Visible = True
Shape1(4).Visible = True
Shape2.FillColor = &H80FF&
End If
If n = 4 Then
Shape1(0).Visible = True
Shape1(2).Visible = True
Shape1(4).Visible = True
Shape1(6).Visible = True
Shape2.FillColor = &HFFFF00
End If
If n = 5 Then
Shape1(0).Visible = True
Shape1(2).Visible = True
Shape1(3).Visible = True
Shape1(4).Visible = True
Shape1(6).Visible = True
Shape2.FillColor = &HFFFF&
End If
If n = 6 Then
Shape1(0).Visible = True
Shape1(1).Visible = True
Shape1(2).Visible = True
Shape1(4).Visible = True
Shape1(5).Visible = True
Shape1(6).Visible = True
Shape2.FillColor = &HFF00FF
End If
End Sub
Private Sub Command1_Click(Index As Integer)
'To indentify which player click the roll dice command
If Index = 0 Then
player = 1
End If
If Index = 1 Then
player = 2
End If

Timer1.Enabled = True
x = 0
End Sub

Private Sub Timer1_Timer()
If x < 100 Then
Call roll
Else
Timer1.Enabled = False

'To check the number on the dice

If Shape1(3).Visible = True Then
num = 1
End If

If (Shape1(2).Visible = True) And (Shape1(4).Visible = True) Then
num = 2
End If

If (Shape1(2).Visible = True) And (Shape1(3).Visible = True) And (Shape1(4).Visible = True) Then
num = 3
End If

If (Shape1(0).Visible = True) And (Shape1(2).Visible = True) And (Shape1(4).Visible = True) And (Shape1(6).Visible = True) Then
num = 4
End If


If (Shape1(0).Visible = True) And (Shape1(2).Visible = True) And (Shape1(3).Visible = True) And (Shape1(4).Visible = True) And (Shape1(6).Visible = True) Then
num = 5
End If


If (Shape1(0).Visible = True) And (Shape1(1).Visible = True) And (Shape1(2).Visible = True) And (Shape1(4).Visible = True) And (Shape1(5).Visible = True) Then

num = 6

End If
'To move player 1 according to the total score of the dice

'Movement across colum1 to column 10 and row 1 to row 10

If player = 1 Then

totalnum = totalnum + num
If totalnum < 11 Then
Image1(0).Move c(totalnum), r(1)
If totalnum = 10 Then
Image1(0).Move c(8), r(3)
totalnum = 28
End If

End If

If totalnum > 10 And totalnum < 21 Then
Image1(0).Move c(21 - totalnum), r(2)
If totalnum = 17 Then
Image1(0).Move c(4), r(4)
totalnum = 37
End If
End If
If totalnum > 20 And totalnum < 31 Then
Image1(0).Move c(totalnum - 20), r(3)
End If
If totalnum > 30 And totalnum < 41 Then
Image1(0).Move c(41 - totalnum), r(4)
If totalnum = 34 Then
Image1(0).Move c(5), r(2)
totalnum = 16
End If
If totalnum = 31 Then
Image1(0).Move c(10), r(7)
totalnum = 70
End If
End If


If totalnum > 40 And totalnum < 51 Then
Image1(0).Move c(totalnum - 40), r(5)
If totalnum = 45 Then
Image1(0).Move c(4), r(9)
totalnum = 84
End If
If totalnum = 44 Then
Image1(0).Move c(1), r(3)
totalnum = 21
End If

End If

If totalnum > 50 And totalnum < 61 Then
Image1(0).Move c(61 - totalnum), r(6)
End If
If totalnum > 60 And totalnum < 71 Then
Image1(0).Move c(totalnum - 60), r(7)
If totalnum = 68 Then
Image1(0).Move c(8), r(5)
totalnum = 48
End If
End If

Iftotalnum1 > 70 And totalnum1 < 81 Then

Image1(1).Move c(81 - totalnum1), r(8)
If totalnum1 = 79 Then
Image1(1).Move c(2), r(6)
totalnum1 = 59
End If
If totalnum1 = 78 Then
Image1(1).Move c(4), r(10)
totalnum1 = 97
End If
End If
If totalnum1 > 80 And totalnum1 < 91 Then
Image1(1).Move c(totalnum1 - 80), r(9)
End If
If totalnum1 > 90 And totalnum1 < 101 Then
Image1(1).Move c(101 - totalnum1), r(10)
If totalnum1 = 95 Then
Image1(1).Move c(8), r(8)
totalnum1 = 73
End If
End If
If totalnum1 > 100 Or totalnum1 = 100 Then
Image1(1).Move c(1), r(10)
End If

End If


'To play the applause sound when any one player reach 100


If (totalnum > 100 Or totalnum = 100) And totalnum1 < 100 Then
Label2.Caption = "Player 1 Wins"
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
MMControl1.DeviceType = "WaveAudio"
MMControl1.FileName = "D:\Liew Folder\VB program\audio\applause.wav"
MMControl1.Command = "Open"
MMControl1.Command = "Play"

End If
If (totalnum1 > 100 Or totalnum1 = 100) And totalnum < 100 Then
Label2.Caption = "Player 2 Wins"
MMControl1.Notify = False
MMControl1.Wait = True
MMControl1.Shareable = False
MMControl1.DeviceType = "WaveAudio"
MMControl1.FileName = "D:\Liew Folder\VB program\audio\applause.wav"
MMControl1.Command = "Open"
MMControl1.Command = "Play"

End If

End If

End Sub

Private Sub Timer2_Timer()
delay
If t < 1000 Then
Else
Timer2.Enabled = False
End If

End Sub

Sub delay()
t = t + 1

End Sub

Output:

Trick-How to use a USB Flash Drive as a RAM Memory?


We use USB to transfer the data’s. The USB can be used asRAM. Let’s start with windows vista; those who use pc’s can use their USBdrives to increase the performances of their computer. This is called ReadyBoost.  Ready Boost deal with free spacethat is on your USB drives, such as RAM. When we increase RAM that’s equal to more speed.  Ready Boost comprise on all free versions ofwindows vista and windows 7. It’s easy to setup the positions and in fewminutes it can be finished.




°Insert the USB drive in your computer.

°Go to "My Computer" then right-click on the USB drive.

°Go to "Properties"

°Next, click on the "ReadyBoost" tab.

°Choose the option that says "Use this device".
Under "Space to reserve for system speed", select the amount of memory that you wish to use for your USB flash drive. The amount of memory that Windows recommends is usually the best setting and should not be exceeded.

°Click on "OK" to save your settings and exit.
Restart your computer for the changes to take affect.

How to set video as desktop wallpaper ?

Ever wanted to set cool videos as your computers Desktop Wallpaper, then you came to right place. Today in this post i will teach you how to set videos as your Desktop Wallpaper with a simple nice little trick and small tool or software that mostly every one has installed on their computer or laptop. This trick works on  Windows Xp as well as it works on windows 7. Go through below post to learn this simple trick.


How to set video as desktop wallpaper ?
   1. Open VLC Media Player. If you don't have it download it frome Here.
   2. Then Go to Tools > Preference Or press CTRL + P and Selecet Video from left panel
   3. Then Choose DirectX video output from output dropdown list
      as shown in below image .

   4. Save the changes ans restart VLC Media Player.
   5. Play any video you would like to set as your desktop wallpaper.
   6. Then click on Video and select DirectX Wallpaper from the dropdown list as show in below image.

   7. Now Minimize vlc player and you will see your video running on your desktop as wallpaper.
   8. If you want your default wallpaper back then uncheck DirectX Wallpaper from video dropdown list.
   9. Hope you like this simple trick share your thought about this trick in comment section.


Use Your Android Phone As Webcam For Your PC


We are going to explore the easiest way to use your Android Smartphone as a webcam, there are many apps available on the internet but this one is the easiest method available to use your Android as a webcam for your PC.


As many of us utilizing desktop and generally we don’t have the webcam. So, What If you desire to do the video call? Don’t worry you have intelligent Android which will let you do video call on your PC. So, on the internet, there are lots of apps available which turns your android into the webcam. But the procedure I’m going to tell you simple and very easy.


You know what? You can also use the android handset as a wireless camera and completely transparent to the operating system. And the reason why Android is commencing in the market is because it is very accessible to many useful apps. So without wasting any time let’s proceed to the steps to use Android camera as a webcam.


Requirements:
1.WebCun Application.
2.IP Camera Adapter.
Steps To Use Android Mobile Phone As Webcam

1. First of all install, the downloaded IP Webcam application on your android mobile phone. Also install the IP Camera Adapter on your PC.


2. Now open the installed IP Camera app on your phone after it you will many options like username, password, screen resolution and many more which you can adjust according to your choice. Now after doing so just click on the Start Server.







NOTE: This app uses back camera as default for better quality but you can also change camera mode to front but it will reduces your video quality.
Now when you clicks on the start server then following that you will see an IP at the bottom of mobile’s screen. Now open this IP in your mobile’s Chrome or Firefox browser. If none of this browser is installed on your android mobile and select Browser built-in viewer option.






Now open and install the downloaded IP camera adapter on your PC. Now in the “Camera feed URL “just enters your IP and port which you got from the app you installed on your phone and remember don’t delete /video feed and then click on Autodetect.




Now that’s it your are done. Open any video conferencing application on your PC like Skype, Facebook messenger, Yahoo! messenger and you will see the video streaming on your PC from your android mobile phone.


How To Use Your Android Phone As Webcam For Your PC – By this easy trick, you can easily turn your android camera into a webcam. You can easily record your phone and capture every moment in your computer browser and with the help of mentioned adapter. I hope this will help you a lot of Thanks for reading this. If you are facing any problem then just comment it below.