Jump to content

Alternative for Send/ControlSend


 Share

Recommended Posts

Why are you duplicating threads? This is te same question you asked in the other thread and it has another common factor; you harping about DLL injection will make people suspicious about your true intentions.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

What do you want to do that Send/Control Send cannot?

It is a general interest question or is the a restriction with Send/Control Send?

GEOSoft was pointing out that most ppl that require DLL injection have malicious intentions.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

#include <SendMessage.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
GUICreate("My GUI edit")
$ControlID = GUICtrlCreateEdit("First line" & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)
GUISetState()

TextSend($ControlID,"Autoit" & @CRLF & "Autoit" & @CRLF)
Sleep(1000)
;Virtual-Key Codes
;;http://msdn.microsoft.com/en-us/library/ms645540%28VS.85%29.aspx
KeySend($ControlID,0x26) ;VK_UP  (0x26)
Sleep(1000)
KeySend($ControlID,0x26) ;VK_UP  (0x26)
Sleep(1000)
KeySend($ControlID,0x26) ;VK_UP  (0x26)
Sleep(1000)
KeySend($ControlID,0x26) ;VK_UP  (0x26)

While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()

Func KeySend($hWnd,$Virtual_Key_Code)
if Not IsHWnd($hWnd) Then _
$hWnd = GUICtrlGetHandle($hWnd)
_SendMessage($hWnd,$WM_KEYDOWN,$Virtual_Key_Code,0)
_SendMessage($hWnd,$WM_KEYUP,$Virtual_Key_Code,0)
EndFunc

Func TextSend($hWnd,$Text)
if Not IsHWnd($hWnd) Then _
$hWnd = GUICtrlGetHandle($hWnd)
For $i = 1 To StringLen($Text)
$Char = StringMid($Text,$i,1)
_SendMessage($hWnd,$WM_CHAR,AscW($Char),0)
Next
EndFunc

Edited by wolf9228

صرح السماء كان هنا

 

Link to comment
Share on other sites

GEOSoft was pointing out that most ppl that require DLL injection have malicious intentions.

I don't really even know what DLL injection is, I just thought it might be related as an alternative.

#include <SendMessage.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
GUICreate("My GUI edit")
$ControlID = GUICtrlCreateEdit("First line" & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)
GUISetState()

TextSend($ControlID,"Autoit" & @CRLF & "Autoit" & @CRLF)
Sleep(1000)
;Virtual-Key Codes
;;http://msdn.microsoft.com/en-us/library/ms645540%28VS.85%29.aspx
KeySend($ControlID,0x26) ;VK_UP  (0x26)
Sleep(1000)
KeySend($ControlID,0x26) ;VK_UP  (0x26)
Sleep(1000)
KeySend($ControlID,0x26) ;VK_UP  (0x26)
Sleep(1000)
KeySend($ControlID,0x26) ;VK_UP  (0x26)

While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()

Func KeySend($hWnd,$Virtual_Key_Code)
if Not IsHWnd($hWnd) Then _
$hWnd = GUICtrlGetHandle($hWnd)
_SendMessage($hWnd,$WM_KEYDOWN,$Virtual_Key_Code,0)
_SendMessage($hWnd,$WM_KEYUP,$Virtual_Key_Code,0)
EndFunc

Func TextSend($hWnd,$Text)
if Not IsHWnd($hWnd) Then _
$hWnd = GUICtrlGetHandle($hWnd)
For $i = 1 To StringLen($Text)
$Char = StringMid($Text,$i,1)
_SendMessage($hWnd,$WM_CHAR,AscW($Char),0)
Next
EndFunc

Thank you wolf. I got the textSend function down, but I'm not sure what the keySend function does? I tried replacing 0x26 (UP key) with something like 0x50(P key) just to test it, and it didn't appear in the edit box? (UP key works)

For example this doesn't work...

#include <SendMessage.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>

$hWnd = WinGetHandle("Untitled - Notepad")
sleep("5000")
_SendMessage($hWnd,$WM_KEYDOWN,0x26,0)
_SendMessage($hWnd,$WM_KEYUP,0x26,0)
_SendMessage($hWnd,$WM_CHAR,AscW("p"))
MsgBox(0,"Handle",$hWnd)
Edited by MirnesC2
Link to comment
Share on other sites

Is there any other alternatives for the Send/ControlSend functions? Any other possible way of sending keystrokes? A DLL injection/call?

Hi MirnesC2,

the only alternative to send keystrokes without using Send or Controlsend has been explained in Search for ControlCommand() in that script.

Hope you find the script useful.

Regards

Delta Rocked.

Link to comment
Share on other sites

Hi MirnesC2,

the only alternative to send keystrokes without using Send or Controlsend has been explained in Search for ControlCommand() in that script.

Hope you find the script useful.

Regards

Delta Rocked.

Hey,

Thanks for the reply, I tried this earlier as well. It doesn't really fit with what I am making. If someone can error check this, I think it may work.

#include <SendMessage.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>

$hWnd = WinGetHandle("Untitled - Notepad")
sleep("5000")
_SendMessage($hWnd,$WM_KEYDOWN,0x26,0)
_SendMessage($hWnd,$WM_KEYUP,0x26,0)
_SendMessage($hWnd,$WM_CHAR,AscW("p"))
MsgBox(0,"Handle",$hWnd)
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...