Results 1 to 26 of 26

Thread: send keys to hiden dos program

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2002
    Posts
    24

    send keys to hiden dos program

    I have successfully sent keys to focused dos program, but anyway to pop up another window (while sending keys to dos) so that the dos is not visible by user? any example codes?thanks

  2. #2
    Hyperactive Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    313
    What eactly are u trying to do? You have sent keys to a dos program with focus but you now want to send keys to one with out focus? It cant be done, unless you knew the memory location of where you are typeing in dos because the send key funtion or what not only sends keys to one with focus

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2002
    Posts
    24
    what i wanted to do is send virtual keys to a dos program(is is still focused), but covered by another non-active windows.

    the purpose is to avoid user to touch on the dos program so that the key sending not disturded.

  4. #4
    Hyperactive Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    313
    just make the form the size of the screen, and have it cover the screen. I think there is an api to disable the keyboard, and then just send keys all day to that dos prompt...never mind you will lose focus hmm...there may be an ontop of command some chat programs have that where they will stay on top and so does xp and 2k when you hit ctrl alt delete and you go to the task manager...could try that make ur program the size of the screen, tell it to say on top and use the find window command to switch focus to the dos program and then disable the keyboard and start sending keys.

  5. #5
    New Member
    Join Date
    Apr 2002
    Location
    uk
    Posts
    5

    Talking Sending keystrokes to another program

    There are a couple of ways to send keystrokes to another program.

    The first and by far the easiest is to use SENDKEYS.

    SendKeys will only send keystrokes to the active application but will work if the active application is not in the foreground.

    the other method requires a little API knowledge.

    You will need to know the KeyCodes for the keys you want to send and, the handle of the window you are sending the keys to.

    Using the PostMessage or SendMessage API calls together with the WM_CHAR windows message, you can pass the keycode of the key you want to send.

    you will need to make seperate calls each time you want to send a keystroke, bt you will be able to send keys to any running proggram window using its handle. The window does not need to have the focus or even be visible.

    I can post an example if anyone is interested.


    Bane
    Just 1 more tweak and that should be.......OH DAMNIT!

  6. #6
    Junior Member
    Join Date
    Sep 2001
    Posts
    19
    I would really appreciate a complete example.
    What I need is to send keystrokes to an specific program (in my case, Ultima Online - a rpg game in case you don't know what it is) but without activating the aplication.

    For example, the program i'm thinking of sends a keystroke every given time (this part is covered, i know how to handle the timers) but at the same time allow me to navigate the web or do other stuff without it constantly focusing the game. This was why Sendkeys didn't work for me.

    Any help would be greatly appreciated.
    Thanx in advance.

    Zeta

  7. #7
    Megatron
    Guest
    You could use the ShowWindow API and hide the console window.

  8. #8
    New Member
    Join Date
    Apr 2002
    Location
    uk
    Posts
    5

    Talking

    Zeta,

    funny you mention UO, because 2 years ago I wanted to do the same thing, so I wrote a program called MrMacro.

    Lets you script macros that use sendkeys to inactive windows. It used to also have an interface to UOAssist to fire its macros and get feedback directly, but ive since removed it from the main app to make it a more generic macro program.

    I'll maybe re-add this as a component later on.

    Soon as I finish the current version, youre welcome to have a Beta copy if you'd like?
    Just 1 more tweak and that should be.......OH DAMNIT!

  9. #9
    Junior Member
    Join Date
    Sep 2001
    Posts
    19
    Thanx Bane. As soon as you have a working (or semi-working) version i'd greatly appreciate you send it to me.

    Either post ir here or send it to [email protected] please.
    Thanx

  10. #10
    New Member
    Join Date
    Apr 2002
    Location
    uk
    Posts
    5
    Zeta,

    if youre looking for similar UO tools then take a look at www.easyuo.com (i think thats the correct address).

    EasyUO was written specifically for Ultima Online, and uses the old peek and poke on memory addresses to fool the UO client into doing stuff just like you were sat there playing.
    Just 1 more tweak and that should be.......OH DAMNIT!

  11. #11
    Junior Member
    Join Date
    Sep 2001
    Posts
    19
    Thanx, but i need this to do it myself cause i need it to send the keystrokes to two diferents windows on diferent timers... i've got all done except sending specific keys to the program

    I know about POSTMESSAGE, but i dunno know how to send keys, all the examples are sending WM_CLOSE.....

    If you could tell me how to send F4 and F3 i'll greately appreciate it.

    Thanx

  12. #12
    New Member
    Join Date
    Apr 2002
    Location
    uk
    Posts
    5

    Wink Sending keystrokes to an inactive window

    See the attached example project on how to use the PostMessage and WM_CHAR windows message for sending keystrokes to inactive windows.

    Its possible to do the same with mouse coords aswell, but Id need to look back at my code to remember how I did it.
    Just 1 more tweak and that should be.......OH DAMNIT!

  13. #13
    Junior Member
    Join Date
    Sep 2001
    Posts
    19
    Thank you very much, i finally managed to do it !!

  14. #14
    New Member
    Join Date
    Jan 2007
    Posts
    1

    Re: send keys to hiden dos program

    Could you please send me too the example of sending the keys to inactive window?
    and also if you have a link to some macro-coders forum of www.eve-online.com I'll very appreciate it.

  15. #15
    New Member
    Join Date
    Mar 2007
    Posts
    1

    Re: send keys to hiden dos program

    anyway i can get an example of this as well??

  16. #16
    New Member
    Join Date
    Jun 2007
    Posts
    13

    Wink Re: Sending keystrokes to another program

    Quote Originally Posted by Bane
    There are a couple of ways to send keystrokes to another program.

    The first and by far the easiest is to use SENDKEYS.

    SendKeys will only send keystrokes to the active application but will work if the active application is not in the foreground.

    the other method requires a little API knowledge.

    You will need to know the KeyCodes for the keys you want to send and, the handle of the window you are sending the keys to.

    Using the PostMessage or SendMessage API calls together with the WM_CHAR windows message, you can pass the keycode of the key you want to send.

    you will need to make seperate calls each time you want to send a keystroke, bt you will be able to send keys to any running proggram window using its handle. The window does not need to have the focus or even be visible.

    I can post an example if anyone is interested.


    Bane

    Yes, yes, Bane, examples, please!

  17. #17
    New Member
    Join Date
    Jun 2007
    Posts
    13

    Re: send keys to hiden dos program

    Gosh - why don't you guys post the scripts when you're done? This is so frustrating. I feel like I've been working on this problem for months, and I get the same stuff.... Something about API and then something about WVCH. Ahg. Something so simple shouldn't take years of experience scripting. It should be instantaneous.

  18. #18
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Sending keystrokes to an inactive window

    Quote Originally Posted by Bane
    See the attached example project on how to use the PostMessage and WM_CHAR windows message for sending keystrokes to inactive windows.

    Its possible to do the same with mouse coords aswell, but Id need to look back at my code to remember how I did it.
    It looks like you forgot to attach the project.

  19. #19
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: send keys to hiden dos program

    This thread is 5+ years old
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  20. #20

  21. #21
    New Member
    Join Date
    Jun 2007
    Posts
    13

    Re: send keys to hiden dos program

    Gahhh, dang Yoda. You and your pointing-out-the-obvious stuff.
    I keep getting errors when I try to do this. I have so many applications for it.

  22. #22
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: send keys to hiden dos program

    Why not just shell a batch file with the window hidden? What is it your trying to process?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  23. #23
    New Member
    Join Date
    Jun 2007
    Posts
    13

    Re: send keys to hiden dos program

    I dunno, Yoda. You really make that sound easy. I guess shelling is like a jump to and hidden is obvious. Anyway, the programs I'd like to do this with aren't all available in the command line, though I did find a few command-line-oriented browsers.
    It is no longer my path, Master Yoda.

    I have found the beauty of c++.

    I turned off warnings, my includes were iostream and Windows.h, using namespace std. The pragma comment was a lib, user32.lib.

    With int main, I basically followed what was given, above. I used HWND, cout, and SendMessage, which were damned hard to understand. I had to look everywhere for guides with examples. I'd give the code, but now that I'm finished. I wish I could translate it to VB, but it seems we've parted paths. Maybe full understanding of the code comes side-by-side with its compilation, anyway.

    I think that a perfect example would be simple, 'Run notepad > run notepad2 > send "Hello world" to notepad without interrupting the activity in notepad2 or making notepad the active window'.

    From there, it's a simple step-by-step. After scouring the web and posting on many forums, I've yet to find the complete script. Only people who indicate that they might be capable, in theory, to generate the scripts, but how do they really know, without making the scripts?
    I believe them as much as they believe themselves, but I think it's horse radish, the whole thing. Me, I'll be able to get my books, at last, without countless hours waiting, and I'll be able to do other things. Anyone else who figures it all out will be able to plug something into their games and in exchange have lives. When I really think about how many cheats I've needed, even to beat Excite Bike, I sure am glad there are people working hard on new ones.

    Anyway, thanks for the feedback. Let me know if you're interested in the c++ version.

  24. #24
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: send keys to hiden dos program

    I'm not into gaming but here on VBF we dont support creating cheats or hacks for cheating at games.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  25. #25
    New Member
    Join Date
    Jun 2007
    Posts
    13

    Re: send keys to hiden dos program

    Well, hey, Yoda, whatever, Master. No one's saying you guys weren't capable of doing it. No one's saying none of the other scripters from the other sites couldn't, either.

    Anyway - it should be considered that this isn't exclusively for gaming, anymore. This is just straight-up useful. I'm glad you're keeping one kid from gaming at the expense of degrading the quality of your forums to the level of others. No offense. But about those other forums, there aren't any good guides for this stuff available. You could write a book on this one script's applications. As a matter of fact, I could think of a few ways this could prevent cheating (though I don't think I'll be making any games complex enough that they'd need prevention methods). I should be saying, 'Who cares about my views?' I usually get banned for them, though I intend them to be neutral. I think the laws of the good make the fall to evil ever-more painful, and the result of evil more hateful (like the frustration from trying to develop cheats, where help isn't available), and I think that it frustrates people in general and prevents people in general from finding equal interest to those around them. Of course, nothing can push someone toward the decline into dissonance or steepen the slope like evil. You're a good guy. *shrug*

    Anyway, I don't think that the commands were intended for gaming, when they were created. I know that you can use these same commands to do things like change Winamp songs and get back the song names so that they appear in your own personally-created plugins for... whatever. Usually the story, then, is, 'we don't support notepad or Winamp or whatever they might plug into,' though.... The truth is, if people think about legit examples and theoretical explanations, there's no going wrong.

    Anyway - I don't think this is a good topic for the forums, anyway. I get the feeling that this is what skiers call an 'expert-only' run. There are books with the commands listed. They just require a little prior knowledge.

  26. #26
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: send keys to hiden dos program

    Quote Originally Posted by Fisthankbeta
    I feel like I've been working on this problem for months, and I get the same stuff.... Something about API and then something about WVCH. Ahg. Something so simple shouldn't take years of experience scripting. It should be instantaneous.
    Programming isn't like breathing - if you want to be able to do it you have to put in the time and effort to learn to do it. If you want someone else to do it for you, you're at the wrong site. Try Rent-A-Coder. You pay in effort or you pay in money, but you pay.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width