GrungeRocker Posted February 18, 2009 Share Posted February 18, 2009 Hey folks!I'm searching for a way to send a Key to a minimized window.So I thought of Posting the WM_KEYDOWN message to the handle and then after a small sleep sending WM_KEYUPSo I ended up with this code:$hWnd = WinGetHandle("Window title") Sleep(2000) $ret = DllCall("user32.dll", "int", "MapVirtualKey", "int", Asc("w"), "int", 0) If IsArray($ret) Then DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x100, "int", Asc("w"), "long", _Long(1, $ret[0])) Sleep(500) DllCall("user32.dll", "int", "PostMessage", "hwnd", $hWnd, "int", 0x101, "int", Asc("w"), "long", _Long(1, $ret[0]) + 0xC0000000) EndIf Func _Long($LoW, $HiW) Return BitOR(($HiW*0x10000), BitAND($LoW, 0xFFFF)) EndFuncLinks to the functions:MapVirtualKey: http://msdn.microsoft.com/de-de/ms646306(en-us,VS.85).aspxPostMessage: http://msdn.microsoft.com/de-de/ms644944(en-us,VS.85).aspxAnd the WM-messages I need:#define WM_KEYDOWN 256 #define WM_KEYUP 257(Taken form winuser.h)Hope anyone can help and tell me an other way or my mistake [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
FireFox Posted February 18, 2009 Share Posted February 18, 2009 (edited) @grungeRocker _SendMessage function with $VM_CHAR for hexadecimal keys like _IsPressed Look at #Include <SendMessage.au3> Cheers, FireFox. Edited February 18, 2009 by FireFox Link to comment Share on other sites More sharing options...
GrungeRocker Posted February 18, 2009 Author Share Posted February 18, 2009 I'm sorry, but I just can't find that include... And maybe I should mention, that I need it for moving in a game, so it is necessary, sending WM_KEYDOWN and WM_KEYUP [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
LarryDalooza Posted February 18, 2009 Share Posted February 18, 2009 It is entirely likely that your game "knows" when it is minimized and ignores input on purpose... You may have no solution. AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
GrungeRocker Posted February 18, 2009 Author Share Posted February 18, 2009 Hm no... It doesn't even work, if the window of the game is active.... So there must be something wrong -.- [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
LarryDalooza Posted February 18, 2009 Share Posted February 18, 2009 did this? ControlSend("title","","","<keystroke here>") Or... $hwnd = WinGetHandle("title") ControlSend("title","",$hwnd,"<keystroke here>") just curious what your attempts have been... AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
GrungeRocker Posted February 18, 2009 Author Share Posted February 18, 2009 " Sending a Key to a minimized Window, ControlSend() won't work" [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
LarryDalooza Posted February 19, 2009 Share Posted February 19, 2009 " Sending a Key to a minimized Window, ControlSend() won't work"well... you outskill me... so I guess I've helped all I can. AutoIt has helped make me wealthy Link to comment Share on other sites More sharing options...
McCraken Posted February 19, 2009 Share Posted February 19, 2009 i have the same problem until I created a topic sends number 1 but the magic does not function and when I open chat I see I number it 1 being typed Link to comment Share on other sites More sharing options...
GrungeRocker Posted February 19, 2009 Author Share Posted February 19, 2009 i have the same problem until I created a topic sends number 1 but the magic does not function and when I open chat I see I number it 1 being typedI don't get your post oO [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
Drew Posted February 19, 2009 Share Posted February 19, 2009 Alot of games have various protection against things like this. Not to discourage you, but out of experience I can tell you your probably S.O.L. Link to comment Share on other sites More sharing options...
GrungeRocker Posted February 19, 2009 Author Share Posted February 19, 2009 Hm... This game is not protected against memory writing... So you can easily Teleport and fly.... But it should be protected against messages, sent by an other program? Man there must be a way to do it [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 19, 2009 Share Posted February 19, 2009 You should say what game you are using it on, someone may have earlier experience with it .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
McCraken Posted February 19, 2009 Share Posted February 19, 2009 I don't get your post oOHere....http://www.autoitscript.com/forum/index.php?showtopic=89905anyone know any software that does this, Sending a Key to a minimized Window or process?thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now