Hi. How can i get handle of button if i don't know it's id? I tried to get it's id with AutoIt and i failed. AoutIt Windows Info doesn't reconsie it as button. I mean i moved cursor on the button and nothing appeared in control tab. Maybe i can send 'ENTER' to window? Because that button is deafault button. Any ideas?
Thank you

Recommended Answers

All 4 Replies

I tried

PostMessage(hWnd, WM_KEYDOWN, VK_RETURN, 1);
PostMessage(hWnd, WM_KEYUP, VK_RETURN, 1);

but it's not working. Please help me guys

Also tried

SetFocus(hWnd);
keybd_event(VK_RETURN, 1, 0, 0);
keybd_event(VK_RETURN, 1, KEYEVENTF_KEYUP, 0);

Fail again. Please someone... I really need it

PostMessage will send the message to the hWnd not to the button. To make myself clear, consider this: PostMessage can send keys to an inactive window.
And IIRC the 2nd arg to keybd_event() is I guess the Scan key code.

I changed ScanCode to 28 and now it works. Sometimes... I made button wich i need to press to send ENTER to other program. If i press that button one time nothing happens, but if i press that button lots of times it send lots of ENTER. Any ideas?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.