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. Mobile Development
  3. Mobile
  4. Sending a BN_CLICKED message

Sending a BN_CLICKED message

Scheduled Pinned Locked Moved Mobile
helptutorialquestion
4 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.
  • I Offline
    I Offline
    illidan99
    wrote on last edited by
    #1

    Hi, I need to send a button click message to a dialog window button from a thread. I use "PostMessage(BN_CLICKED, IDC_GPS,m_hWnd) " but I think the lparam and wparam are incorrect. I don't find an example or something else. Can anybody help me? Thank you. Regards. Regards, Javier

    I J 2 Replies Last reply
    0
    • I illidan99

      Hi, I need to send a button click message to a dialog window button from a thread. I use "PostMessage(BN_CLICKED, IDC_GPS,m_hWnd) " but I think the lparam and wparam are incorrect. I don't find an example or something else. Can anybody help me? Thank you. Regards. Regards, Javier

      I Offline
      I Offline
      illidan99
      wrote on last edited by
      #2

      I try to use use PostMessage(WM_COMMAND, MAKEWPARAM(IDC_GPS, BN_CLICKED), handle>). Then I try to use "HWND GetDlgItem( int nID )" to get the button handle, but the compiler makes a error: I can use Cwnd::GetDlgItem ( ) , but not CWindow::GetDlgItem , which returns the button handle. How can I use the Window classe? Thanks. Regards, Javier

      1 Reply Last reply
      0
      • I illidan99

        Hi, I need to send a button click message to a dialog window button from a thread. I use "PostMessage(BN_CLICKED, IDC_GPS,m_hWnd) " but I think the lparam and wparam are incorrect. I don't find an example or something else. Can anybody help me? Thank you. Regards. Regards, Javier

        J Offline
        J Offline
        Joao Paulo Figueira
        wrote on last edited by
        #3

        The BN_CLICKED message is a notification sent to the button's parent window. If you want to simulate a button press, send the BM_CLICK message to the button. Regards, João Paulo Figueira Embedded MVP

        I 1 Reply Last reply
        0
        • J Joao Paulo Figueira

          The BN_CLICKED message is a notification sent to the button's parent window. If you want to simulate a button press, send the BM_CLICK message to the button. Regards, João Paulo Figueira Embedded MVP

          I Offline
          I Offline
          illidan99
          wrote on last edited by
          #4

          Hi, João . ok, I use: HWND Hbutton = GetDlgItem(ptrDlg->m_hWnd,IDOK); SendMessage (Hbutton,BM_CLICK,0,0); from my thread and it works. Another question: if I want to send it from the same dialog window (for example from other button), How can I get the handle to the button? Well, I test the following: SendDlgItemMessage(IDC_GPS,BM_CLICK, 0, 0 ); from the same dialog and it works. Thanks Regards, Javier

          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