Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

VB6 Right Mouse Button Click Event

I want to make an event handle when right mouse button is clicked on form.I cannot find it in the vb6 events for form.

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Button Mouse Click Event

Can two Forms (Form1 & Form2 with Command1 & Command2 BUTTONS on each Form) be set to display (visible) at same time, & to enable EITHER of the two buttons be clicked thus firing Command1_Click () / Command2_Click () ?? Or must one be set to have the focus? Doesnt moving the mouse over the buttons & clicking the mouse automatically gives the button covered the focus?

Also, is there corresponding Registry ACTIVEX API functions to the Webbrowser Control Events module, ie without using Webbrowser Event Control package?

Please provide brief sample codes if possible.

How To Automate To Detect A Left Mouse Click Without Using The Form Mouse Click Event
hello all ,How do I automate to detect a left mouse click without using the form mouse click event ?

Mouse Up Event Misfired In The Righ Click Event Of The Flexgrid! Help Needed

When the user right click the first column of the MSHFlexgrid then a PopUpMenu rises, for that i coded as below. But when the user click the row header which i used to display the Serial No. there also the popupmenu rises. how to avoid this. I am using the below code to identify the First column of the grid and rise the popupmenu.
so i am getting problem. because when the user click a item in the popupmenu then i the next form is show with the value of the MshFlexgrid FirstColumns text..

Private Sub MSHFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)

    If Button = vbRightButton And MSHFlexGrid1.MouseCol = 1 Then
        Me.PopupMenu mnuReport
    End If

End Sub

How to solve this problm. Kindly suggest your idea.

Thank you very much,

<B><font color="#008000">HAVE A NICE DAY !</font></B>

Raising A Mouse Click Event Without Clicking On The Mouse
I want to raise a mouse click event on a form in a project from another
project without actually clicking on the command button..

For eg:
I have an application which has a sign in form where i accept username
and password... There is a sign in command button..
I want to try and sign in from another project without actually
clicking on the sign in button...
i.e I want to call the commandbutton_Click( ) function of that command
I know there is something like "reflection" in C# (VB.NET) but i want
to do this in Visual Basic 6.0...

Click Mouse While Mouse Button Is Being Held
What I want to do is have the program click the mouse button really really fast, while the user is holding the button down. I cant really think of what I could do. I was thinking I could tell it to goto the timer on form_mousedown and in the timer have code to click (dont know the syntax for making the mouse click).
I dont know how I would be able to tell when they let go of the button either.

VB Code:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)    GoTo Timer1_TimerEnd Sub Private Sub Timer1_Timer() mouse_leftclick If MouseDown = False Then    GoTo StopTimerEnd If End Sub Private Sub StopTimer()'Stops the timer from executingEnd Sub

Would that If statement work? I just guessed at it. But if someone could tell me the sytax to click the mouse or if there's a better way to do this let me know please. Thanks

Mouse Click Event
1.) I can't seem to find code for the mouse click event for anywhere that a user clicks on a form, including textboxes, listboxes, and buttons. I am trying to code for a log out method for my pos program. If a user clicks anywhere on the form, I will have a timer to go on, and after 2 minutes, if the position is still the same, the pos will log out to the original log in screen. This will help to prevent other users from getting on another user's account that has been left on. I don't need any other code except that of how to detect what position the mouse is at after it is clicked anywhere on the screen.

2.) The code will have to detect for any form other than the main screen, so I'm guessing some type of global code here. Would I have a way of just putting the code into a module and referencing it instead of copying the code for every form?

Much Appreciated,


Mouse Click Event
I have an application which includes a frame on which is placed a number of command buttons. When a button on the main form is pressed the frame becomes visible and when a button on the frame is pressed the frame becomes invisible.

What I am looking for is a way of detecting a mouse click on any other part of the main form (or one of its components) while the frame is visible to indicate that the frame is no longer required and will then become invisible. I need this frame to function similar to a pull down menu which will disappear if you click on any other object, but will activate the selected fuction if that is pressed.

Simulate A Mouse Click Event
Hello, is it possible that when i press a button it reactes the same as i would have clicked with my mouse on it? I tried MouseDown, things like that but i guess its a little bit harder than that.

Capture A Mouse Click Event
I have a login form with two fields, UserID and Password (duh !!)
It also has two controls, OK and CANCEL.

I also have a routine in the code that calls a message box routine if the UserID loses focus that activates if there is no UserID is entered (UserID="").

Is there a way to capture the mouse click on the CANCEL control that will set a flag or some other way bypass the LostFocus routine?

Thank you,


How Can I Get Left Click Event Of Mouse?
HI All!
In my application i have to have all the three events of a mouse.... like left click, right click and the middle button(scroll) click events.

I already wrote the event mouses's down event. in that event i am able to get the middle button(scroll)'s event and right click event, but i am unable to get the left button's click event....

How can i get this Leftclik event of mouse? here is my sample code...

Private Sub Image1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = 4 Then
boolDragDrop = True
End If

If Button = 2 Then
Delete.Tag = Index
Me.PopupMenu RClick
End If

If Button = 1 Then 'this is not working..... how can i get this ?
MsgBox (" is button1")
End If

End Sub

Please let me know... if u know this..

Thanks in advance:

Disable Click Event Of The Mouse
How can I disable the click event of the mouse, while I'm doing some data retreive, then after that I want to enable it.

Mouse Co-ordinates On Click Event
How do I get the Mouse Pointer Coordinates on the _Click event? I know I can get them using the _MouseDown Event, but I need them on the _Click event.

Mouse Click Event Coding
I remember seeing some code on a while back on how to make the system right click or left click and also how to make them double click. I searched and i can't find it anymore on the web at all. Can someone link me to somewhere or can someone just make a bas file and send me a copy of it to my email address? i really need this for some program i am working on. Thanks, i need this asap...

im trying to make a program that will move the mouse around to certain areas of the screen and then click or double click on that spot. So i need the code for the system to right/left to click/double click
thats what i need...can you help?


Failure Of Mouse Click Event
I am working on a project that depends on obtaining real-time data from a web site. When I go to this web site, I must first log in. I am then at a page where I must choose (by mouse click) one of three options. This choice takes me to a page where again I have numerous choices to make before arriving at the page which contains the data I want. I am attempting to obtain this data programmatically rather than visually.
    My approach to the project follows. The project is still in design mode so I have broken it into several steps which I will later combine. I have at this point a form containing a web browser, two command buttons and a text box. When I start the project the web browser navigates to the desired web page. Since I must log in and since the log in text boxes are not visible on my browser I click the click the first command button which is captioned “Log In”. The click event code uses the mouse event API to first move the cursor to the down arrow of the web browser scroll bar, and then click the required number of times (predetermined) to bring the log in textbox into view. The cursor then moves and clicks to bring focus to the textbox. The keyboard event API is then used to enter my personal data, after which the browser navigates to the next page. At the present state of development of the project I now manually choose between the 3 options bringing up the page with numerous choices. I now click the 2nd command button which is captioned “Get Active Choices”. This click event first gets the HTML behind this page by using the command: WebBrowser1.Document.body.innerHTML. By studying the patterns of this HTML I am able to see the pattern when choices are active and by previous visual inspection of the page I have programmed the number of clicks on the scrollbar and the location of where to click on the page in order to bring up the page where the data I want is. When I have this page I can get the desired data by the method of decoding the HTML.
    After this detailed description we come to the problem. After I click on the “Get Active Choices” command button, the cursor does move to the scroll bar location but it either does not click, or the scroll bar does react to the click. Consequently when the cursor moves over (and clicks – maybe) the predetermined position on the browser page it is not over and clicking on the embedded button --- it does not navigate to the right page and I don’t get my data. I emphasize that the first time I used this process by clicking on the “Log In” button it works fine –the scroll bar moves down and I can see the page move down.
    This is added as perhaps a clue. In an attempt to solve the problem on my own (an attempt now over 12 hours long) I added a third button to the form with the code shown below. When I click on this button the scroll bar does move down – that is , it works!!!! If I put a stop at end sub it does not work although all of the code occurs before the stop. Can it see the future?? Thanks in advance

Code:Private Sub Command3_Click()
    XPosition = 1460 * 65535 / 1600
    YPosition = 842 * 65535 / 1200
    'move mouse to down arrow position
    mouse_event MOUSEEVENTF_MOVE Or MOUSEEVENTF_ABSOLUTE, XPosition, YPosition, 0, 0
    'click mouse 12 times
            For m = 1 To 12
                mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_ABSOLUTE, 0, 0, 0, 0
                mouse_event MOUSEEVENTF_LEFTUP Or MOUSEEVENTF_ABSOLUTE, 0, 0, 0, 0
            Next m
End Sub

Code: [/code]

Mouse Event Click &lt;solved&gt;
Hey, i was wondering how i could simulate a mouse click at a certain location on the screen. If anyone has any ideas on how to do this please respond.


Edited by - crazyoldman on 1/14/2006 5:03:32 PM

How Do I Disable The Mouse Click Event.

On my form I have a Frame containing 6 Textbox's and I need to stop the user from clicking on these Textbox's with the Left mouse button but I still need the user to be able to Tab from one box to the next. On the forum I have seen 2 API's that claim to disable the mouse click but I cannot get either one to work.

If anyone can help I would be most gratefull.


Left Mouse Click Event
How can I make the click event code of a label execute only to a left mouse click? And I dont want to put the code in the mouse up and mouse down events.

Capturing Mouse Click Event

On my VB form, i have a command button for which i want that whenever it is clicked, i should call a module. How do i do that?

Highlight Row In MSFlexiGrid On Mouse Click Event
Can someone please tell me how to highlight one row of MSFlexiGrid on the mouse click event. Thanks.

Image Control Mouse Click Event?

I am trying to use Image Control MouseDown and MouseUp event. It is responding for right mouse click. But not for left mouse click. Even it is not responding for Click and Double_Click event too.

What could be problem?


Right Click Mouse Event Into A List View
i am new to VB and need ur help.

i need to implement right click mouse event into a list view. how can this be done??
Info on any sites that explain these with simple code examples will also be helpful.
Thanks in advance.

Why Mouse_Move Returns Mouse Click Event?

I believe you all know how to put the application to the system tray (use Shell_NotifyIconA). What I want to ask you is why we can use the X coordinate in the Mouse_Move event to determin double click?

Thank you in advance.

Need An API Function To Repeat Mouse Click Event.
Hello everybody
I'm searching for a solution to repeat mouse click event. It sounds stupid but I really nead it. My purpose is when user click mouse, it will switch to dblclick event automaticlly.
I think SendMessage API function can do it, but I don't know how to use it in detail. Anyone can help me?
Thanks for any suggestions.

How To Capture Mouse-click Event For A Paragraph In MS WORD.
Some of the buttons in MS office toolbars have additional functionality when you double click them.. e.g. Format painter button in Word. When this button is double clicked it stays selected and subsequent document clicks are captured and the selected word/sentence are formatted. I want to make a similar button which remains pressed when it is double clicked and then inserts a word at the curser position whenever i click the document.
Would be glad if someone helps me in this.

Detecting The Mouse Click Event With A Combo Box Control
Does anyone know if there is a mouse click event fired when a combo box dropdown is clicked. The click event seems to fire only when something is selected from the dropdowm list. But if nothing is selected the event appears not to happen.

I need a way to detect the click event even if nothing is selected or no changes are made to the selection.

Can anyone help?

Mouse Click On A Button By Its Name
I've got to write a little automation routine to allow my users to push any of the buttons on various little (external) applications or dialogs.

I want to isolate the user from all the windows handle crud and just require them to give the titlebar text along with the text inside of the button to be pushed.

I pretty much know how to get the handle of an application by its titlebar text.

Now I want to send a mouse click to one of its buttons.

How would I make it so that my program will send the mouse click to a button by its name?

Do I use SendMessage?

This API stuff is killing me....

thanks for any help.

Right Mouse Button Click
How can I add my program to the Right Mouse Button Menu on the windows explorer.
I wanted to do like the Winzip program, if you click on a .zip file with the right button you get a item on the menu to open with Winzip.

Mouse Pop-up From Button Click
Is there some way I can write data to a pop-up bubble on a mouse click over the picture box.

Basically I want something like the "whatsthishelp" bubble.

I know how to capture the mouse click I just don't know how to create the bubble.


Mouse Right Click Button
It is possible that when a user press the mouse right click button nothing happens?

Mouse Click On A Button By Its Name
I've got to write a little automation routine to allow my users to push any of the buttons on various little applications or dialogs.

I want to isolate the user from all the windows handle crud and just require them to give the titlebar text along with the text inside of the button to be pushed.

I pretty much know how to get the handle of an application by its titlebar text.

Now I want to send a mouse click to one of its buttons.

How would I make it so that my program will send the mouse click to a button by its name?

Do I use SendMessage?

This API stuff is killing me....

thanks for any help.

Cmd Button Click Event

in my project ........ i have a cmd button called next
each time the user clicks it ...... i need different sets of code to execute
and it should be done in a certain order

for eg .....
after the first click .... frame 1 appears
then after the second click ....... frame 2 appears and frame 1 disappears
and so on

can someone tell me how it can be done

thanks in advance

Click Event Of Button

i want to know if one application can send a click event to another application. BTW...just incase, this click event willl be for a button lying in App2 and App1 has to send the event Message....

if it can .... how???

Button Click Event Within Another
Hi Guys,

Is it possible to call a Button click even within another button click event?

Something Like the following

VB Code:
Private Sub CmdAdd_click()If Mode = "Edit" then      CmdMod_clickEnd IfEnd Sub

Button Click Event
Hi All,

I've got an MDI form with a toolbar populated with button images from an
image list.

Does anyone know what to pass to the Toolbar1.ButtonClick event ?
Everything I try results in a "type mismatch".

Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

The event looks at the button.key to determine which code to process, I'm
trying to call the Toolbar1.ButtonClick via "hot keys" on a child form.

Thanks much in advance for any help,

Dave Tucker

Click Event For ANY Button

Is it possible to catch the click event for ANY button on a form - instead of writing the same piece of code for each individual button??

If so how do I collect the name of the button clicked, and does VB then ALSO process the event for that individual button afterwards??



How Do I Create A Mouse Click Event That Clicks On A Certain Point On The Screen
IM tryin to create a program using vb, which clicks on certain points on the screen based on a timed duration. Im having trouble figuring out which function to use to send a mouse click to a specific xy point on the screen .. would win api sendmessage function work.. are there any other ways to create this event.... ? thanks..... this will be used to click in a internet explorer window... but i do not need to click a specific button.. just a point in the window... and i was hopin there was a way to abstract the event out from a command... i just want the program to click on different points on the screen.... thanks again

How To Get A Mouse Click After A Button Has Being Clicked
i need to find out how to collect a mouse click on a picture box after a command button has been clicked.

Get Mouse Right Button In Double-click
I was making a code with popmenu when I noticed that there was no button type in DoubleClick. I need it to exit sub when the button is right clicked.


How To Get A Mouse Click After A Button Has Being Clicked
i need to find out how to collect a mouse click on a picture box after a button has been clicked.

Use Mouse Right-click To Press A Button

How would I make a button that will activate using either the left OR right mouse buttons?


Left Mouse Click Button
How can i disable the left click button in a listview...??!

How Can I Detect Mouse Click And Button With Api?
Can anyone please help?

I want to detect the mouse click and button number within a mousemove event and not in its own event.

What it is, im using Waty Thierry's tray icon code (avaliable all over the net & that uses a picture box as a tray icon, however mousedown/up dont work from the tray icon, but mousemove does, so i need to somehow detect the mouse down inside the mouse move event..

Does anyone have any ideas?

thanks in advance

How To Disable Right Mouse Button Event
I have to utilized both mouse button click event in my program. Right mouse button click event is already using by Windows (when we press Right Mouse button over Text box, Windows display popup menu Cut, paste, delete , select all), I want to use my own menu instead of windows. How can I disbale windows default Right mouse click event?



Mouse Button In Keydown Event
How can I recognize which mouse button is clicked using the keydown event. In MSDN is mentioned that there is a keycode.

If the Left mouse button is clicked then the keycode should be :vbKeyLButton
but this doesn't work

Has anyone a suggestion?

Middle Mouse Button Event
is there any way to response
to click of middle mouse button..

Click Event Of Invisible Button
Hi guys a bit of a puzzler...

I have a button on my form that is invisible. I don't want the user to be able to see the button. But I do need the button to be able to excute it's click event if someone does click the invisible button?

Is their anyway of doing this with out making the button visible?

Option Button Click Event

I have graphical option buttons setup on a main screen. I am trying to set one of the buttons based on a user selection on startup. (So it could be any button) I have a sub in a module called "RefreshForm" that has this code:

If gstrFilePath(i) = gstrFilename & ".rtr" Then
frmMyMain.optRotorButton(i).Value = True
frmMyMain.optRotorButton(i).Value = False
End If

My problem is that there are two ways for the user to make a selection. One is to click on an option button which calls the RefreshForm sub...thus setting the buttons value.....and the other way is for the use to use the File menu to make their selection. If they use the File menu then the RefreshFrom sub is called..and the Button value is set AND THIS IS WHAT CALLS THE CLICK EVENT which I DO NOT WANT. How can I keep the CLICK EVENT from happening when the user does NOT press a button?


Button Click Event - Help Needed
i dont know how to put this but what i want to know is that,
is it possible to call button click on another form?


Handle Event Button Click
Can Any body Help !

I want to handle Internet Explorer Html Submit/Button through my vb application. I mean to say whenever any person clicks on Submit/Button in html page in internet browser, this Event handled by my running application.

Copyright 2005-08, All rights reserved