Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. can anybodyhelp me with the right click problem

can anybodyhelp me with the right click problem

Scheduled Pinned Locked Moved Visual Basic
helpcsharp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    farah mazhar
    wrote on last edited by
    #1

    i want to send the right click sub routine that i've formulated, through send message funtion to windows in vb.net so that it can work same as normal right click does what i am doing is Public Sub RightClick() RightDown() RightUp() End Sub Public Sub RightDown() mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0) End Sub Public Sub RightUp() mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0) End Sub Public Sub ClickButton(ByVal ButtonHandle As IntPtr) 'send the right mouse button "down" message to the button... Call SendMessage(ButtonHandle, MOUSEEVENTF_RIGHTDOWN, 0, IntPtr.Zero) 'send the right mouse button "up" message to the button... Call SendMessage(ButtonHandle, MOUSEEVENTF_RIGHTUP, 0, IntPtr.Zero) 'send the button state message to the button, telling it to handle its events... Call SendMessage(ButtonHandle, BM_SETSTATE, 1, IntPtr.Zero) Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown RightClick() ClickButton(Windows.Forms.MouseButtons.Right) 'MessageBox.Show("show") End Sub please help me where i am going wrong farah

    D 1 Reply Last reply
    0
    • F farah mazhar

      i want to send the right click sub routine that i've formulated, through send message funtion to windows in vb.net so that it can work same as normal right click does what i am doing is Public Sub RightClick() RightDown() RightUp() End Sub Public Sub RightDown() mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0) End Sub Public Sub RightUp() mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0) End Sub Public Sub ClickButton(ByVal ButtonHandle As IntPtr) 'send the right mouse button "down" message to the button... Call SendMessage(ButtonHandle, MOUSEEVENTF_RIGHTDOWN, 0, IntPtr.Zero) 'send the right mouse button "up" message to the button... Call SendMessage(ButtonHandle, MOUSEEVENTF_RIGHTUP, 0, IntPtr.Zero) 'send the button state message to the button, telling it to handle its events... Call SendMessage(ButtonHandle, BM_SETSTATE, 1, IntPtr.Zero) Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown RightClick() ClickButton(Windows.Forms.MouseButtons.Right) 'MessageBox.Show("show") End Sub please help me where i am going wrong farah

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      farah mazhar wrote:

      i want to send the right click sub routine that i've formulated, through send message funtion to windows in vb.net so that it can work same as normal right click does what i am doing is

      This doesn't make any sense at all. Are you trying to send a right-click to a control in your app?? Or are you trying to send a right-click to another application's window?? Your other problem is that you copied and pasted this code from another website without understanding what it's doing. I'm willing to be that you have the Declares statements wrong because the code on the other site is written for VB6 and you're using VB.NET. Since there are big differences between the data types with the same names in the two languages, most notably the Long type, the code is not going to work in VB.NET without some conversion.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups