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. sendmessage help

sendmessage help

Scheduled Pinned Locked Moved C / C++ / MFC
comhelptutorialquestion
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.
  • I Offline
    I Offline
    imran_rafique
    wrote on last edited by
    #1

    can any body tell how to click a button using sedmessage method? i did not know the last three parameters execpt HWND plz explain last three parameters ? r00d0034@yahoo.com

    P 1 Reply Last reply
    0
    • I imran_rafique

      can any body tell how to click a button using sedmessage method? i did not know the last three parameters execpt HWND plz explain last three parameters ? r00d0034@yahoo.com

      P Offline
      P Offline
      Peter Occil
      wrote on last edited by
      #2

      To reiterate a reply I made here: The SendMessage function sends a message to the window procedure of a window. It doesn't return until the window fully processes the message. You should never send messages to windows of other applications because it is possible that the application may be hung and SendMessage will never return. This is the prototype of SendMessage.

      LRESULT SendMessage(
      HWND hWnd, // handle of destination window
      UINT Msg, // message to send
      WPARAM wParam, // first message parameter
      LPARAM lParam // second message parameter
      );

      The hwnd parameter, as you know, is the handle to a window to which to send a message. The Msg parameter identifies what type of message to send, and the wParam and lParam parameters specify additional information about the message. The system and applications communicate to windows via messages. Besides SendMessage, there is the PostMessage function, which sends a message to a window and returns immediately, making it ideal for communicating with windows in other applications. To answer the second question, to programmatically simulate a button click, make the following call:

      SendMessage(hwndBtn,BM_CLICK,0,0);

      Peter O.

      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