google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.: Write a Visual Basic program to find the mouse position on screen and number click made by user on screen.

Monday, February 23, 2015

Write a Visual Basic program to find the mouse position on screen and number click made by user on screen.

Write a Visual Basic program to find the mouse position on screen and number click that is Left, Right and Double made by user on screen form .

First Design Form Window (mousepose.frm):-


Second Design Form Window (summary.frm):-

Code:- for first form

Dim cnt As Integer
Dim cnt1 As Integer
Dim cnt2 As Integer

Private Sub Command1_Click()
Form2.Show
Form2.Text1.Text = cnt
Form2.Text2.Text = cnt1
Form2.Text3.Text = cnt2
End Sub

Private Sub Form_DblClick()
cnt2 = cnt2 + 1
LblDblClick.Caption = cnt2
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
    cnt = cnt + 1
    LblLeftClick.Caption = cnt
End If
If Button = vbRightButton Then
    cnt1 = cnt1 + 1
    LblRightClick.Caption = cnt1
End If

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim strpos As String
Dim xpos As Integer
Dim ypos As Integer

xpos = X
ypos = Y
strpos = "x : " & xpos & "   y : " & ypos
Label1.Caption = strpos
End Sub

Private Sub form_load()
cnt = 0
cnt1 = 0
End Sub

Private Sub LblRightClick_Click()

End Sub



------------------------


Code for Second form summary form:-
Design Window:-

Private Sub Command2_Click()
Unload Me
End Sub
============================================
OUTPUT




Second Output of Summary :-




अच्छे विचार करे विचार

  पहचान की नुमाईश, जरा कम करें... जहाँ भी "मैं" लिखा है, उसे "हम" करें... हमारी "इच्छाओं" से ज़्यादा "सुन...