WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Control Manager
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Send Enter key to an Edit Box

 Keywords: return enter send editbox 

Question:

I'm using cSetEditBox from the Control Manager Extender to populate edit boxes in a window. I've had to use this instead of SendKeys because i'm using the script as a NT service (and SendKeys does not work in a service - even if it's interacting with the desktop - if a user is not logged on). besides, cSetEditBox is supposedly more reliable.

The problem I'm hitting is this: when I attempt to commit the changes to the edit boxes, I'm forced to send a RETURN keystroke because there is no 'OK' button or 'COMMIT' button or any buttons at all for that matter. The developers of this program expect the user to simply hit the ENTER key.

Is there any way I can get the cSetEditBox to submit a RETURN keystroke? If I append @CRLF to the text that goes into the edit box, the characters @CR and @LF are interpreted literally by the edit box. that is, the box displays two invalid characters (after the text that's supposed to be in there). Perhaps there is a way to 'escape' the @CRLF?

Answer:

So you tried the following and it didn't work?
cSetEditText(editwnd, StrCat(text,@CRLF))

I wonder if changing focus, using cSetFocus, to another control, whether it will commit changes to the edit box...

Or

Maybe the cSendMessage function can be made to work, but what numbers to use. Whether or not you can do this may depend on how familiar you are with Windows programming and various debugging tools. What *I* would do is get a copy of some WIndows message Spy utility and try to capture some of the windows message traffic that happens when you press the enter key, and try to slip my own message in to replace what is missing when the enter key is hit in the script.

User Reply:

Thanks very much for your help on this matter. I got it to work! This command below actually simulated a user hitting the 'RETURN' key.
WM_CHAR = 258
cSendMessage( Hwnd, WM_CHAR, 13, 1835009 )

Article ID:   W15398
File Created: 2017:07:28:12:58:27
Last Updated: 2003:05:13:10:27:28