Jump to content

Send the {Enter} key with ControlCommand()


Recommended Posts

Sometimes I cannot find way way out of a paper bag with a knife in my hand...

I can use ControlCommand() to fill in an EditBox, but I cannot figure out how to send the {Enter} key to the Control ID.

I've tried ControlFocus() and ControlSend() and Send() but nothing works

Link to comment
Share on other sites

$hWnd = ControlGetHandle("Untitled - Notepad", "", "Edit1")
$user32 = DllOpen("user32.dll")
$ret = DllCall($user32, "int", "MapVirtualKey", "int", 0x0D, "int", 0)
$lParam = BitOR($ret[0] * 0x10000, BitAND(1, 0xFFFF))
If IsArray($ret) Then
    DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", 0x0D, "long", $lParam)
    Sleep(1)
    DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x101, "int", 0x0D, "long", BitOR($lParam, 0xC0000000))
EndIf
DllClose($user32)

Is that what you're looking for?

Edited by Outshynd
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...