Thread: Virtually pressing a button

  1. #1
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342

    Post Virtually pressing a button

    How do I virtually press this button? (HWND hMyButton)

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    SendMessage() and use BN_CLICKED
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Like this:?

    SendMessage(hMyButton, BN_CLICKED, 1, NULL);

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    more like....

    SendMessage(hDialog, WM_COMMAND, MAKEWPARAM(ID_MYBUTTON, BN_CLICKED) , hwndMyButton );

    should have MAKEWPARAM() ( and MAKELPARAM() ) from including Windows.h
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Okay, I got it, thanks.
    Last edited by Queatrix; 08-19-2005 at 10:33 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. screen color detection and button pressing
    By cwn11 in forum C Programming
    Replies: 1
    Last Post: 11-23-2008, 10:39 PM
  2. Pressing a button works sometimes
    By johny145 in forum Windows Programming
    Replies: 14
    Last Post: 05-18-2005, 11:53 AM
  3. writing text over a deleted button
    By algi in forum Windows Programming
    Replies: 4
    Last Post: 05-02-2005, 11:32 AM
  4. Pressing A Button on Dos..
    By yakabod in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 01-30-2003, 07:46 AM
  5. Pressing a button in another app
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 03-11-2002, 12:53 PM