Results 1 to 6 of 6

Thread: [RESOLVED]Sendmessage radio button click

  1. #1

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    708

    [RESOLVED]Sendmessage radio button click

    I've looked around here, and found some examples, but still cant get this API to click a radio button. This is stupid, it must be me.


    Is this how the API should be called?

    VB Code:
    1. lhWndParent = exe.MainWindowHandle.ToInt32
    2. lhWndButton = FindWindowEx(lhWndParent, 0, "Button", "&Continue sieving an old file")
    3.  
    4. SendMessage(lhWndButton, WM_COMMAND, 0, 0)
    5.  
    6. 'or
    7.  
    8. SendMessage(lhWndParent, WM_COMMAND, lhWndButton, 0)

    I've tried several variations, and wonder if it's a problem with the recieving application... or me.
    Last edited by TTn; Oct 5th, 2006 at 03:59 PM.

  2. #2
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: Sendmessage radio button click

    It must be the first one, because the last 2 parameters are message-specific info.

    What errors are you getting?? And make sure that you are getting the handle of the desired radio button.
    Show Appreciation. Rate Posts.

  3. #3

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    708

    Re: Sendmessage radio button click

    I'm not getting any errors directly, but it isn't clicking the button.

    The handle should be right(findwindowex), since I can disable the button via that handle. I used SPY++ to find the Button's caption, and class name "Button". It's not working on a regular button either.

    The program in question, can be found here:
    http://primes.utm.edu/programs/NewPGen/

    I want to click the start/stop button, and the radio check button, for new/old file.


    [EDIT]
    I've edited the first post, to show the button's caption.
    Last edited by TTn; Oct 5th, 2006 at 12:09 PM.

  4. #4

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    708

    Re: Sendmessage radio button click

    I guess two lines will have to do for now:

    VB Code:
    1. SendMessage(lhWndOldButton, WM_KEYDOWN, VK_SPACE, 0)
    2.             SendMessage(lhWndOldButton, WM_KEYUP, VK_SPACE, 0)

    This seems to work for the regular button too. duh

    [RESOLVED]

  5. #5

  6. #6

    Thread Starter
    Fanatic Member TTn's Avatar
    Join Date
    Jul 2004
    Posts
    708

    Re: [RESOLVED]Sendmessage radio button click

    why not send a BM_CLICK message
    Because I didn't know it was there, ofcouse. lol

    Thanks, I'll try it and rate ya.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width