SendMessage

Is there any way to send the "Enter" button using the sendmessage functions?
MChuAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
bshuler072699Connect With a Mentor Commented:
Use SendKeys.
0
 
MChuAuthor Commented:
i know sendkeys works but it gets messy because you ain't sure if it is setfocus on it at the time.  Is there any way to use sendmessage instead?
0
 
tmackCommented:
Mchu.

What are you trying to accomplish?? Are you trying to send a message using the MAPI control?? More info please....

T
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
bshuler072699Commented:
Because you give no details, I will give you the process.

1: Do the task you want to automate a number of times by hand. Try not to do it with a mouse. Write down the strokes.

2: Use Spy++ to watch the messages. Only watch the Keyboard messages if you can.

3: Write SendMessage statements to replicate the activity.

Or the easy way:

1: Use FindWindow to get a handle to the window you want to send keys.

2: Use SetActiveWindow to make sure the keys go to the right window

3: Use send Keys to do the dirty work. Reuse SetActiveWindow if you need to do a lot and you are woried about user intervention. Also, buttons are 'windows'. So you can use FindWindow and IsVisible to check and see if the OK button is there yet, or IsEnabled to see it it is greyed or clickable.
0
 
MChuAuthor Commented:
i want to put text into a text of another application, and in order for the application to pick up the text you have to send the enter key.  i could use sendkeys but i am not that the focus would be at the textbox at the time. if there any way to send the enter key using sendmessage?
0
 
tmackCommented:
MCHu,
I'm not sure how you would do this other than what was already suggested. (using the SENDKEYS)...

T
0
 
bshuler072699Commented:
The way that you ensure that you are using SendMessage to the correct text box is by sending the keys to the TextBox's Handle.

How do I find the text box handle?

Enumerate the child windows
Check each window for class - maybe thunderbox, check in Spy++
Check each window for the offset from its parent.


If the parent is at 1000, 1000 and the child is at 1500, 1500 then the offset is 500, 500. It is very unlikely that there will be 2 text boxes that are at the same offset from their parent. If you run accross one that is the same, then also check for the size of the text box.

Any way, Get a list of handles to check using EnumChildWindows, then evaluate their class and offset using GetWindowRect and GetClassName

0
All Courses

From novice to tech pro — start learning today.