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. C#
  4. How to raise Mouse click event

How to raise Mouse click event

Scheduled Pinned Locked Moved C#
tutorialquestion
6 Posts 5 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.
  • B Offline
    B Offline
    bloo2k
    wrote on last edited by
    #1

    Hi All! I want to write a program that can raise mouse click event( in other window or desktop), but i don't know how to raise that event.:(( Any Idea??

    P E C L B 5 Replies Last reply
    0
    • B bloo2k

      Hi All! I want to write a program that can raise mouse click event( in other window or desktop), but i don't know how to raise that event.:(( Any Idea??

      P Offline
      P Offline
      Polis Pilavas
      wrote on last edited by
      #2

      Can you rephrase the question please? Regards, Polis Can you practice what you teach?

      1 Reply Last reply
      0
      • B bloo2k

        Hi All! I want to write a program that can raise mouse click event( in other window or desktop), but i don't know how to raise that event.:(( Any Idea??

        E Offline
        E Offline
        enjoycrack
        wrote on last edited by
        #3

        Hi there, You can use SendMessage API... it should be something like SendMessage(iHandle, WM_LBUTTONDOWN, 0, lparm); << >>

        1 Reply Last reply
        0
        • B bloo2k

          Hi All! I want to write a program that can raise mouse click event( in other window or desktop), but i don't know how to raise that event.:(( Any Idea??

          C Offline
          C Offline
          Curtis Schlak
          wrote on last edited by
          #4

          You need to investigate SendMessage and PostMessage. Then, you need to understand the constants WM_LBUTTONDOWN and WM_LBUTTONUP. Then, read Test Run: Low-Level UI Test Automation and you will know everything that you need to accomplish what you want to do. "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty

          1 Reply Last reply
          0
          • B bloo2k

            Hi All! I want to write a program that can raise mouse click event( in other window or desktop), but i don't know how to raise that event.:(( Any Idea??

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Hi! To send windows a mouse event, you can use the "mouse_event" API of the user32.dll. Decalre as following: [DllImport("user32.dll")] private static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData, int dwExtraInfo); Here are some constants needed, saved in an enumeration: private enum MouseEventTFlags { LEFTDOWN = 0x00000002, LEFTUP = 0x00000004, MIDDLEDOWN = 0x00000020, MIDDLEUP = 0x00000040, MOVE = 0x00000001, ABSOLUTE = 0x00008000, RIGHTDOWN = 0x00000008, RIGHTUP = 0x00000010 } Now, you can call it like this: mouse_event((uint)MouseEventTFlags.LEFTDOWN, 0, 0, 0, 0); mouse_event((uint)MouseEventTFlags.LEFTUP , 0, 0, 0, 0); When you send the press-button-down-event, you need to send the press-button-up-event too! Marcel Erz

            1 Reply Last reply
            0
            • B bloo2k

              Hi All! I want to write a program that can raise mouse click event( in other window or desktop), but i don't know how to raise that event.:(( Any Idea??

              B Offline
              B Offline
              bloo2k
              wrote on last edited by
              #6

              Thanks for your great help, i can raise some event, i'll have to find out how to use it effectively.

              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