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 / C++ / MFC
  4. Button press simulation

Button press simulation

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 4 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.
  • P Offline
    P Offline
    paper67
    wrote on last edited by
    #1

    Hi, How can a button press be simulated, so when you do the call you can see the button going down and up again, and the corresponding button handler gets called. I use the following code now. ((CButton *) GetDlgItem(IDC_MOD))->SendMessage(BM_CLICK); The button handler gets called, but the button doesn't go down and up again. Is there any other way to achief this ? Thx

    S 1 Reply Last reply
    0
    • P paper67

      Hi, How can a button press be simulated, so when you do the call you can see the button going down and up again, and the corresponding button handler gets called. I use the following code now. ((CButton *) GetDlgItem(IDC_MOD))->SendMessage(BM_CLICK); The button handler gets called, but the button doesn't go down and up again. Is there any other way to achief this ? Thx

      S Offline
      S Offline
      squidev
      wrote on last edited by
      #2

      Have you tried sending WM_LBUTTONDOWN+WM_LBUTTONUP (with proper point) ? I haven't tried it, but it seems to be the starting point of a button press... HTH :-O squidev

      P 1 Reply Last reply
      0
      • S squidev

        Have you tried sending WM_LBUTTONDOWN+WM_LBUTTONUP (with proper point) ? I haven't tried it, but it seems to be the starting point of a button press... HTH :-O squidev

        P Offline
        P Offline
        paper67
        wrote on last edited by
        #3

        According to the MSDN documentation the BM_CLICK message generates a WM_LBUTTONDOWN and a WM_LBUTTONUP message. See : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/buttons/buttonreference/buttonmessages/bm\_click.asp I figured out that when I shift the focus to a button on a regular dialog and I hit the key no down and up movement is seen. Could it be possible that everything goes so fast that you cann't see it ?

        D F 2 Replies Last reply
        0
        • P paper67

          According to the MSDN documentation the BM_CLICK message generates a WM_LBUTTONDOWN and a WM_LBUTTONUP message. See : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/buttons/buttonreference/buttonmessages/bm\_click.asp I figured out that when I shift the focus to a button on a regular dialog and I hit the key no down and up movement is seen. Could it be possible that everything goes so fast that you cann't see it ?

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Why not just use Spy++ to see what messages are sent to the control and dialog? Once found, then it's just a matter of repeating them via code.


          "Take only what you need and leave the land as you found it." - Native American Proverb

          1 Reply Last reply
          0
          • P paper67

            According to the MSDN documentation the BM_CLICK message generates a WM_LBUTTONDOWN and a WM_LBUTTONUP message. See : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/buttons/buttonreference/buttonmessages/bm\_click.asp I figured out that when I shift the focus to a button on a regular dialog and I hit the key no down and up movement is seen. Could it be possible that everything goes so fast that you cann't see it ?

            F Offline
            F Offline
            FarPointer
            wrote on last edited by
            #5

            try something like WM_GETDLGCODE , that might prevent the dialog from taking the focus from the controls ,and if it doesn't work then at design-time set the TAB order. Regards Farpointer

            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