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




Right-click Menu And Sending Left Click To Item


Can anyone tell me how I can use insert a right-click menu into my program so that when the user has selected a file (in a file list) and right-clicks, a menu appears at the location of the mouse pointer. I aleady know how to use the PopupMenu function to show a menu as I suppose that will need to be used, I just don't know how to capture a right-click mouse event and also use the position of the mouse pointer to show the menu.

Thanks in advance!




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Making Right-Click In A ListBox Select An Item Exactly Like The Left Click.
Heres a start:


Code:
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
'Place code to select the item
End Sub

I need help where the comment is. Thanks

Disable MDI Parent's System Context Menu Right & Left Click Menu Pop-up. How?
I am trying to do this without much luck, but managed to get rid-of the Min/Max buttons via an MS example at the link below.

http://support.microsoft.com/default.aspx?scid=kb;en-us;137033

However, when a user right clicks on-the MDI parent's Caption bar, a popup up menu appears - Woud like to prevent that.

Secondly, if a user "LEFT" Click on the top Left corner of the same Caption bar (where the Icon appears); it pops the same Pop-Up Menu - Like to stop that.

Thirdly, If a user double clicks on the same menu bar, form flickers, bobs down & up (Min & back to Max state), looks back at you and say's "fooled Ya!", as if it was possessed by some sort of strange evil code. Now I Would really, really, like to make it stop doing that.

Basically, like to prevent any mouse action on MDI Parent's Title Bar. Searched for couple of hours in vain (pain), but nothing turned up for what I am looking for. I can stop the right click on the form it-self by detecting mouse down button, but that’s not preventing the click event in MDI parent's title/caption bar.

Anyone know how or what needs to be done to get this to work? Any and all help, suggestions, etc. will be greatly appreciated!

Sending Left Mouse Click To Another Program
Hey, i want to send send a mouse click to another program, in a certain amount of time like say every 5 seconds, it doesn't matter where the cursor is going to be but if i have to set a position i will, anybody got an example i looked all over the forum but nothing thx in advance

Pop Up Menu - I Only Want It To Come Up When U Right Click But It Comes Up On Left To
How can I make my popupmenu come up only when the user right clicks, right now it comes up when you right click or you left click. I am using this popup menu with a dbgrid. I don't know if that has anything to do with it.
Thanks
Eric

Left Click Menu & Error Message
heya guys

I was wondering if it is possible to have a sub menu appear when the user left clickson a certain item. i have seen a few VB6 programs which have done it and as wondering if anyonecould tell me how to do it. Also then once i have done it how to remove it if i so wish.

Thank you in advance

Frosty

Left Click Form Icon Menu
When you left click on a form's icon you get a small menu appear (with Restore, Mimize, Close etc.) Is there anyway of adding another item to this menu?

I found this post which looked promising

http://www.vb-forum.com/showthread.p...=titlebar+icon

but the link to the external website does not work.

Any ideas?




Added green "resolved" checkmark - Hack

Add Custom Menu Item To Windows Right Click Context Menu ????
Hi everyone

Earlier today there was a thread with this Q in it but it wasnt ever resolved. What i want to do is add my own custom entry to the windows menu that pops up when you right click on an something in particular to the edit menu. So when you select some text no matter what app your in it has my custom menu option in it along with the usual copy and paste and what not.

Can this be done

If so how and where do i start ??

API Click Menu Item?
u know with VB in AOL how u can click the buttons, like to send an IM or Open Email, by getting the handle and using the SendMessage() API. can u do it like this with a menu? im tring to be able to open email with the Mail menu, i was able to click it and bring down the menu, but how do i have it click on one of the menu items? to bring up New/Old/Sent Mail. or would u jus use the arrow keys (Virtual Keys[VK]) to do this?

Right Click On A Menu Item?
I need it for my webbrowser... I want the user to be able to right click on a menu item and choose... say open new window, or something like that.

Is it possible?

Add Item To Right Click Menu
When i Right Click a Textbox can i add a menu there? in any textbox on any prog
? if so how ?

Click On Menu Item [vb6]
Hi,

I have a menu with a lot of submenu.

I would like to know if it's possible to know when the user click on a main menu item, even if he show the submenu items.

I hope Im clear.

Let me know if part of code or example is needed.

Thanks you for your help.

best regards.

yk.

Click Event On A Menu Item
I have 2 forms... one a MDIForm with a menu and the another mdichilt.

In the MDIform I have

Code:
Private Sub mnuIndividualSpinsTypeIn_Click()
frmNewSpins.Show
End Sub

What I want to achieve is create some buttons on the other form (a customized control panel) that i should add it to the right of my mdiform, as a task panel and have the same features as some menu items.

For example I have a button that i want to do the exact thing as the mnuIndividualSpinsTypeIn does on click.
I tried to call the click event function from the second form, but it doesn't work... how can I do this?


Code:
Private Sub imgNew_Click(Index As Integer)
Select Case Index
Case 0:
frmMain.mnuIndividualSpinsTypeIn_Click
End Select
End Sub

API Click Popup Menu Item
i found out how to click a Menu with API:
Call PostMessage (targetWindow, WM_COMMAND, MenuID, 0)

but how do i do this with a popup menu? would i have to find the MenuID for the popup menu? if so, how would i do that?

THANKS

Adding Item To R-click Menu In IE.
in not even sure if its on topic here, but i was wondering how do they add item to right click menu in IE. is it possible w/ VB?

How To Add A Right Click Menu To ListView Item??
How to add a right click menu to ListView item??

Click Menu Item - WM_COMMAND
i know how to click a menu item with WM_COMMAND :

Call PostMessage(Me.hwnd, WM_COMMAND, 2, 0) , does 1st item in menu, but i wanted to know how to do this with popup menus?

THANKS

Help With Selecting An Item In A Right Click Menu
Anyone know how to select (as in 'click') an item from a right click menu? for example, if i right clicked in IE, how would i 'click' or select the option "Set as wallpaper".. anyone know?

Calling Up My .hlp File From A Menu Item Click...how?
Hello,

Using RoboHelp, I created an hlp file for my application. I want to use a menu click to call up the help file...not sure how to do it. I am only finding context id related stuff in the vb helpfile. I will get into that down the road but for now just want to run my help file.

Thanks!

Execute A Program On Menu Item Click
Hello All,
How can we execute a program when the user clicks on a particular SubMenu Item, say File/Save As in Photoshop or File/Save As in WORD.
Instead of poping up the real Save As form of the application, I have to display my custom save As form.

How To Detect Item Chosen In A Right Click Context Menu?
When you right click on a textbox, you get the cut,copy,paste, and delete context menu. How can I detect which of these choices was selected?
I need to create a text validation on what action was taken, but validation only happens when you move off the textbox. So if a user should close the app or refresh the app, I can detect what action was taken and validate it.

Resolved - Calling Button Code By Menu Item Click
I have a working button code.
I would like to call same by clicking menu list item.
how do I do it?

Right Click For Popup Menu, But Select The Item Right Clicked Upon [List Box]
Hi,
  I have a list box which holds several list items (logs). I want to right click on the individual list items and select them (which only works with left click) and then show a popup menu.
  The list item must be selected because the popup menu would have commands specific to the 1 file. E.g. delete log

 How do I accomplish this?

Thanks in advance

--------------------------------------------------
Should I apologize if what I say burns your
ears and stains your eyes?!

Adding A Custom Right Click Item To The Web Browser Control's Pop Up Menu In VB6
Somebody else asked this same question regarding .net but I'm using VB6 and the Browser control so hopefully someone can give me an answer as well.

Does anyone know how to create a custom right click menu item to the web browser control in VB6? What I want to do is add a menu option that is enabled when a user right-clicks on a link in the browser that starts with a common URL string. For example, let's say I want this menu item to be enabled ONLY when the link goes to a URL starting with http://www.vbcity.com/forums/ so it would be enabled if one right-clicked on a link to http://www.vbcity.com/forums/post.asp?method=reply&tid=52321 but not to http://www.vbcity.com. Can anyone tell me how to do this?

Thanks,
Dan

Adding An Item To Default Context Menu For R/click On App Title Bar
How do I add an item to the default context menu of a Window(s).. The right click on an app title bar or Task bar icon.. (Restore, Move, Size, Minimize, Maximize, Close)
I want to add a few things to it like 'OnTop' and 'Hide' and a few other things.. I can do everything but the adding to the context menu.

Right Click And Left Click Order?
Hello folks,

Here is my problem and I would appreciate your input.

When I want to left click on a lable, I want the colors of the label to change in one order.
When I want to right click on this label again, I want the color to change in opposite order.

It does the job but has one bug. For example, when I left click it works as expected but when I right click, it behave as it is left clicked (once) and then it changes to the opposite order. Please check the attachment. Thanks


Code:

Option Explicit
Dim intIncrementor As Integer

Private Sub Label3_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Private Sub Label3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
' Select Case Button
' Case vbRightButton
' MsgBox "right button down"
' Case vbLeftButton
' MsgBox "left button down"
' End Select
'End Sub
Label6.Caption = intIncrementor

    Select Case Button
        Case vbRightButton
            'intIncrementor = intIncrementor - 1
            If intIncrementor = 0 Then
                Label3.BackColor = &H0& 'black
                intIncrementor = intIncrementor - 1
                Label3.Caption = "black"
                intIncrementor = 9 'reset to end
            ElseIf intIncrementor = 1 Then
                Label3.BackColor = &H404040 'brown
                intIncrementor = intIncrementor - 1
                Label3.Caption = "brown"
            ElseIf intIncrementor = 2 Then
                Label3.BackColor = &HFF& 'red
                intIncrementor = intIncrementor - 1
                Label3.Caption = "red"
            ElseIf intIncrementor = 3 Then
                Label3.BackColor = &H80FF& 'orange
                intIncrementor = intIncrementor - 1
                Label3.Caption = "orange"
            ElseIf intIncrementor = 4 Then
                Label3.BackColor = &HFFFF& 'yellow
                intIncrementor = intIncrementor - 1
                Label3.Caption = "yellow"
            ElseIf intIncrementor = 5 Then
                Label3.BackColor = &HC000& 'green
                intIncrementor = intIncrementor - 1
                Label3.Caption = "green"
            ElseIf intIncrementor = 6 Then
                Label3.BackColor = &HFF0000 'blue
                intIncrementor = intIncrementor - 1
                Label3.Caption = "blue"
            ElseIf intIncrementor = 7 Then
                Label3.BackColor = &HC000C0 'violet
                intIncrementor = intIncrementor - 1
                Label3.Caption = "violet"
            ElseIf intIncrementor = 8 Then
                Label3.BackColor = &HC0C0C0 'gray
                intIncrementor = intIncrementor - 1
                Label3.Caption = "gray"
            ElseIf intIncrementor = 9 Then
                Label3.BackColor = &HFFFFFF 'white
                intIncrementor = intIncrementor - 1
                Label3.Caption = "white"
            End If
     
        Case vbLeftButton
            If intIncrementor = 0 Then
                Label3.BackColor = &H0& 'black
                intIncrementor = intIncrementor + 1
                Label3.Caption = "black"
                Label5.Caption = intIncrementor
            ElseIf intIncrementor = 1 Then
                Label3.BackColor = &H404040 'brown
                intIncrementor = intIncrementor + 1
                Label3.Caption = "brown"
            ElseIf intIncrementor = 2 Then
                Label3.BackColor = &HFF& 'red
                intIncrementor = intIncrementor + 1
                Label3.Caption = "red"
            ElseIf intIncrementor = 3 Then
                Label3.BackColor = &H80FF& 'orange
                intIncrementor = intIncrementor + 1
                Label3.Caption = "orange"
            ElseIf intIncrementor = 4 Then
                Label3.BackColor = &HFFFF& 'yellow
                intIncrementor = intIncrementor + 1
                Label3.Caption = "yellow"
            ElseIf intIncrementor = 5 Then
                Label3.BackColor = &HC000& 'green
                intIncrementor = intIncrementor + 1
                Label3.Caption = "green"
            ElseIf intIncrementor = 6 Then
                Label3.BackColor = &HFF0000 'blue
                intIncrementor = intIncrementor + 1
                Label3.Caption = "blue"
            ElseIf intIncrementor = 7 Then
                Label3.BackColor = &HC000C0 'violet
                intIncrementor = intIncrementor + 1
                Label3.Caption = "violet"
            ElseIf intIncrementor = 8 Then
                Label3.BackColor = &HC0C0C0 'gray
                intIncrementor = intIncrementor + 1
                Label3.Caption = "gray"
            ElseIf intIncrementor = 9 Then
                Label3.BackColor = &HFFFFFF 'white
                intIncrementor = intIncrementor + 1
                Label3.Caption = "white"
                intIncrementor = 0 'reset to start
            End If
    End Select
    
End Sub




 

Adding An Item To The Right-click Context Menu Of Network Neighbourhood Computers
Well, read the title!

Is there any way of adding a custom link to my program to the right-click menu of computers on a LAN in Network Neighbourhood?

Kinda like a link which passes the name of the computer onto the proggy ... ?

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 ?

Menu Click = Picture Box Click
I have a strange problem. I have a picture box and when the menu drops down and I make a selection on it the picture box captures the event and fires the mouse click event. Normally this would be no problem but the mouse click depends on what is plotted and seeing as how nothing is plotted I get an error message. Nothing wrong with the error because nothing is printed.

Does anybody know how to get around this?

I hope I have explained it good enough!

Right N Left Click
Hi,


How can i define wether the right or left mouse button has been clicked?

Thanks in advance


Ciao

Steve

Left And Right Click
now this is a problem with clicks!
i have a msflexgrid and when i select a row it highlights that row and other rows alternatingly by the given function below

its working perfect

also i have a mouseup event for the same grid it also works but i want it like this

when i right click a row the row must get selected first then the popup menu should appear.but what actually happens is that if i have selected the first row and then right click over the 3rd row .the 3rd row does not get selected but the selection remains over the first row! .how do i solve this


VB Code:
Private Sub msfg4_Click()Dim j%, iCurRow%Static iLastRow As Integer     With msfg4        If .Row = 0 Then Exit Sub        iCurRow = .Row        If .Row <> iLastRow Then            .Row = iLastRow            For j = 1 To .Cols - 1                .Col = j                If iLastRow Mod 2 = 0 Then                    .CellBackColor = ODDROW_COLOR                Else                    .CellBackColor = EVENROW_COLOR                End If            Next j        Else            Exit Sub        End If        .Row = iCurRow        For j = 1 To .Cols - 1            .Col = j            .CellBackColor = SELROW_COLOR        Next j        iLastRow = .Row    End With End Sub

Right Click, Left...etc
I was wondering how to make a specific button on the key board do a certain task (shoot, move ... ) but can someone give me a code to help me out or a tuturial?

Left/ Right Click
How can I detect the left/right if the object haven't mousedown, mousemove, mouseup... event??
How can I make the mouse right click whereever it is on the screen through code?

Click Item In Listview Then Show That Item In Combo As Index = 0
Hi guys,

I have a listview (lvwUserPunchedOut) that is populated with records in a database (persons first name in one column and last name in the second column), what I am looking to do is if I select a persons name by clicking on it in the listview on frmMain, and then bring up frmSearchCriteria, i would like to show that selected name in the combobox as default (cboEmployee.ListIndex = 0) on frmSearchCriteria (the combobox is sorted = True and is also populated with first name and last name of the person)

How would this be done? Hope I make sense. Thanks in advance.

VXFlexGrid Left Click
I am using VXFlexGrid and when you left click it selects a cell. Is it possible to repeat this behavior with the right click? Some how I would have to get the xy of the click, then do try and pass that to the flex grid to let it knwo what cell to select? I couldn't find the right functions, or maybe i'm barking up the wrong tree?

Click.top/.left Capture
under the Form_Click sub, how would you say:


Code:
Private Sub Form1_Click

(click).Top = top 'variable
(click).Left = left 'variable

'where (click) is whatever the click is called

End Sub

On Right And Left Click Events
i also have a thread up about click and double click events but can someone plz tell me how to turn the following into read VB code

private sub label1_leftclick()
bit of code
end sub

private sub label1_rightclick()
a different bit of code
end sub

yeh somethin like that

thnx a lot im sure it could be done

Mouse Click: Left Or Right
Hi,

I'm looking for some code to paste in the label1_click event to let this event only work when the left mouse button is pressed and not the middle or the right mouse button?

Thank you,

Gaz

Emulating A Left Click.
Hello,

This is probably a silly question but I was wondering how you could make Visual Basic 6.0 emulate a left click on a specific location?

So if you have a button on your form you make your code left click on command1!

Is that possibe and if so how would you go about it?

Thanks

Fraggy

PS: I hope my question was clear?

Left Click Over And Over Again On A Location?
How do you have it so when you press a command button the next place you click will be clicked over and over again until you click again? Thanks in advance

How To Define On Left Click &gt; Do Something
i knew that ...but im so old that i forget things =] hhhhh
please remind me =]

**and if some moderator see that ...can i donate the forum via paypal? if i do ..how?

Playing A .wav On Left Click
Im using this code to play a .wav file everytime i left click

Code:
Option Explicit

Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Private Const SND_ASYNC = &H1


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


sndPlaySound _
"The file Path", _
SND_ASYNC



Everytime i click on the form it will make the .wav play. But thats the thing it only plays when i click on the form. I want it to still play even if i click off the form. Thanks in advance.

Left &amp; Right Mouse Click!
A ListView is populated with many items (all the items are URLs of web pages). I want that when any of the items is left-clicked with the mouse, then the user should be taken to that URL but if any of the items is right-clicked with the mouse, then a pop-up menu should come up. I tried it this way:
VB Code:
[color=blue]Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)    Item.SmallIcon = 2    wWeb.Navigate2 Item.TagEnd Sub Private Sub ListView1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)    If (Button = 2) Then        PopupMenu mnuPopup    ElseIf (Button = 1) Then        Call ListView1_ItemClick(ListView1.SelectedItem)    End IfEnd Sub[/color]
The problem with the above code is that when I right-click any item in the ListView, then the pop-up menu comes up but at the same time, the browser opens the URL that was clicked. How do I prevent the browser from navigating to the URL when any of the items in the ListView is right-clicked?

In fact, I didn't include the ElseIf condition in the ListView1_MouseUp event function but since right-clicking any item was taking the user to the appropriate URL, I added the ElseIf condition but that doesn't make any difference.

Thanks,

Arpan

How Would I Add A Left Click To This Button?
Code:
Private Sub Command1_Click()
Inet1.Execute "http://neopets.com/games/launch_game.phtml?age=0&chall=0&dc=&hiscore=600&sp=0&va=1&world=Space+Station&height=500&width=500&user_full_name=sasa_kill&r=1395972&game_id=156&nc_referer=neopets&questionSet=&quality=High"
End Sub

Left/Right Click In ListView
How can i dertermind if the user has clicked the left or right button on a listView control. Basically if the user right clicks they get a pop up menu, but there is some code that i only want to be run if the left mouse is clicked. Currently it displays my popup menu and runs my code if the right mouse is clicked. Hope that hasnt confused you all too much! Any help greatly appriciated

Malb

Left And Right Mouse Click
I want to allow users to use the left mouse click while the right one will do something else... is there any way to check for which mouse button is clicked or _Click ?

~$uper-$tar

Disable The Left Click...
Here is the problem:

I have a ListView that list lots of URLs...

And I want to disable the left click in the "ItemClick"(ListView) method...

The user can only open when clicking with the right button

Apreciate,

Dany Gregory.

Left Mouse Click
how can I get VB to send a left mouse click to windows
so that windows thinks that the user did it over
the item the mouse is over

Mouse Left Click
Does anyone know what the code for a Left Mouse Click is? i want to loop certain keys in a continous cycle, i've completed the keyboard, i just need the code for the mouse. heres an example.

Private Sub Timer2_Timer()
SendKeys "z"
End Sub

Any help is appriciable
thanks.

Left Mouse Click Question
hello all.

i've come accross a small problem with mouseclicks and can't seem to find the awnser, and wondered if anyone knew how to do this.

basically all i want it to do is.

if label1.backcolour = vbred then
'click the left button on mouse
end if

any feedback would be greatly appreciated.

toothpick

Copyright © 2005-08 www.BigResource.com, All rights reserved