Jump to content
neverlose

SendMessage WM_KEYDOWN WM_KEYUP do not work.

Recommended Posts

neverlose

Hello all.

I am having the next code: http://pastebin.com/ngTvAi8G

And it is not working for me. I have Windows 7 64 bit. Also tried on Win XP 32 bit and it also do not work.

The key is in WM_KEYDOWN WM_KEYUP messages. I also tries WM_CHAR - don't works. But it works with MOUSE messages (KEYBOARD doesn't work). I tried to use mouse messages (button down or mouse move - it works, but there is another value of Lparam (coordiantates)).

If you can help me with advance, I would very appreciate it.

 

I also tried to use PostMessage function, but it also do not work.

 

UPD: If I use PostMessage function, the space sending is working in my Chrome browser address bar, but it is not working in notepad. - It seems there's some kind of Windows security?

Edited by neverlose

Share this post


Link to post
Share on other sites
RaiNote

"$botenabled" Bot for what?

Edited by Melba23
Unneccessary quote removed

  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
neverlose
; Program process run
While True
        ; If program is enabled
   If $botEnabled Then
          $hwnd = WinActive('')
          If $hwnd <> 0 Then
                 _SendKey($hwnd, 0x20) ; 0x20 for Space
                 Sleep(500)
          EndIf ; end of $hdwnd <> 0
   EndIf ; end of If $botEnabled
WEnd

It is just a flag to start/pause of sending the space button

Share this post


Link to post
Share on other sites
Melba23

neverlose,

Just why do you need to spam the {SPACE} button? And why not use the native Send function if you really need to do it?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
neverlose

Space - is just to simplify the example.

The Send() function sends keys only to the active window.

But with DllCall I can pass custom $hwnd. So I can send keys to the window that is not active. For example: when the window is minimized.

 

Edited by neverlose

Share this post


Link to post
Share on other sites
Melba23

neverlose,

What JohnOne said.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
neverlose

ControlSend doesn't fit here. Because the $hwnd object may vary. Plus there's no ability to get the CondrolId in $hwnd for which the script will be used.

Share this post


Link to post
Share on other sites
Melba23

neverlose,

ControlSend can take $hWnd as the first parameter - and there is not always a need to specify the ControlID as long as it does not need to be focused. To what inactive app are you trying to send these keystrokes?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
neverlose

If ControlID is not required, then it may fit.

I just tried to used the following command:

ControlSend($hwnd, "", "", "{ENTER}exampletext", 0)

But it don't passed the "{ENTER}" button to my $hwnd.

If I change code to: ControlSend($hwnd, "", "", "exampletext", 0) and then I will press ENTER in my $hwnd manually the text "exampletext" is written correctly.

Share this post


Link to post
Share on other sites
Melba23

neverlose,

If the text appears AFTER you press {ENTER} then surely you should use:

ControlSend($hwnd, "", "", "exampletext{ENTER}", 0)

Or even

ControlSend($hwnd, "", "", "exampletext", 0)
ControlSend($hwnd, "", "", "{ENTER}", 0)

And you have still not indicated the nature of this inactive window to which you wish to send keystrokes.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
neverlose

About $hwnd - It doesn't metter. I am trying this on active window (while testing)

{ENTER} - toggles chat window. So In total I should get {ENTER}exampletext{ENTER}

I tried to use {ALT} for example - it, also, doesn't passed to the $hwnd.

But the $hwnd is special. If I try to use the same script in notepad or browser - the keys are send.

I can guess that the $hwnd has some kind of security.

Because I cannot explain why in one window (notepad) the special keys like {ENTER} {ALT} works, but in the other one (the special one) works only simple letters a-z and chars, but keys {ENTER} {ALT} etc. doesn't work.

Edited by neverlose

Share this post


Link to post
Share on other sites
neverlose

Some tests:

{!} - Sends 1

{#} - Sends 3

{SPACE} - Sends common space, as it should be.

Edited by neverlose

Share this post


Link to post
Share on other sites
Melba23

neverlose,

Because I cannot explain why in one window (notepad) the special keys like {ENTER} {ALT} works, but in the other one (the special one) works only simple letters a-z and chars, but keys {ENTER} {ALT} etc. doesn't work

Because certain "special" windows have anti-bot measurse to prevent you from interacting normally - and interaction with such windows is usually prohibited by the Forum rules. As you have now refused to answer my questions concerning the nature of this "special" window twice, I can only assume that the above is indeed the case (especially looking at your posting history) - so I am locking the thread. If you wish to inform me that the window is indeed legal, feel free to PM me and I will reopen it.

M23

 


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Melba23

Hi,

It seems that the special window was a "MU online" server - which of course the OP claims is not prohibited. Which part of:

Launching, automation or script interaction with games or game servers, regardless of the game

is so hard for game-botters to understand? To me it seems quite clear - and there are no "special cases", so stop trying to pretend that you are the exception.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×