Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 85

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 85

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
[C#] Best way to simulate keystrokes
Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: [C#] Best way to simulate keystrokes

  1. #1
    Junior Member
    Join Date
    Jul 2009
    Posts
    22

    [C#] Best way to simulate keystrokes

    Hello guys,

    I'm studying c# and trying to develop a bot which simulates keyboard strokes and mouse clicks.

    But i'm having some troubles:
    1# I only manage to send keyboard strokes with the client in focus, with the SendKeys. Tried SendMessage, and PostMessage... did not work.


    Can you guys put me in right direction?
    Whats the best way to simulate keyboard?
    Is there any ready api? (tried InputSimulator API, but does not work on non focused windows)

    Thank you very much!

  2. #2
    Senior Member Lolrapa's Avatar
    Join Date
    Mar 2014
    Posts
    125
    Never tried it but how are you getting the parameters for sendMessage?

    Sending keys and mooving mouse is ok, but sometime the element you want to interact with moove in the screen, like creatures
    The best method to do this is by sending the packets directly to the server and there are several ways to do this

    Tibia has a function that sends packets to the server, once you find you can use it at will
    1) by thread hijacking
    thread hijacking it basically to create a thread in tibia with a cavecode (a little code) that will call tibia function and thath will do the action like mooving, eating etc

    http://tpforums.org/forum/threads/48...ight=tibiasock
    http://tpforums.org/forum/threads/5463-Update-tibiasock
    (there is a c# version written by klusbert)

    2) by injected dll
    You can create a dll which you can inject into tibia and tibia will run all the code you write in your dll, that way you will gain access to tibia memory and function call via pointers
    So you just to call the packet function from there

    3)by injected dll
    Same way as before but instead calling the function to send the packet you can use the socket to send the packet directly to the server (you have to build the packet this way)
    https://bitbucket.org/farsa/minidash...default#cl-165

    Ofc both three ways need some work out and solve some synchronization problems

    There is a lot of info in this forum that will help you out and you can write whenever you need help I will be glad to help you!!
    Bye!
    Last edited by Lolrapa; 05-31-2015 at 03:49 PM.

  3. #3
    Administrator
    Join Date
    Mar 2007
    Posts
    1,723
    SendMessage/PostMessage is the best way to simulate keyboard and mouse events. Use Spy++ to record these messages and view their parameters, then you can recreate them to get the desired outcome.

  4. #4
    Junior Member
    Join Date
    Jul 2009
    Posts
    22
    thanks for hleping guys.

    @Lolrapa
    I dont want to send packages to the client, one may think this is detectable.

    @Jo3Bingham
    i used the spy++ tool (thanks for the tip), and i've came to this code.

    Code:
            [DllImport("user32.dll")]
            public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
    
            [DllImport("user32.dll")]
            public static extern IntPtr PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
    
            static void Main(string[] args)
            {
               
               Process notepad = Process.GetProcessesByName("notepad")[0];
               
               const uint WM_KEYDOWN = 0x100;
               const uint WM_KEYUP = 0x0101;
               const uint F1_KEY = 0x70;
    
               SendMessage(notepad.MainWindowHandle, WM_KEYDOWN, ((IntPtr)F1_KEY), (IntPtr)0);
               SendMessage(notepad.MainWindowHandle, WM_KEYUP, ((IntPtr)F1_KEY), (IntPtr)0);
    
                System.Console.ReadLine();
            }
    What i'm trying to do here, is send a F1 keystroke to notepad, but its not working. Can you give a hint?

  5. #5
    Senior Member Lolrapa's Avatar
    Join Date
    Mar 2014
    Posts
    125
    Code:
                const uint WM_KEYDOWN = 0x100;
                const uint WM_KEYUP = 0x0101;
                const uint F1_KEY = 0x70;
                Process k = Process.GetProcessesByName("notepad")[0];
                IntPtr H = k.MainWindowHandle;
                PostMessage(H, WM_KEYDOWN, ((IntPtr)F1_KEY), (IntPtr)0);
                PostMessage(H, WM_KEYUP, ((IntPtr)F1_KEY), (IntPtr)0);
    This is working for me

  6. #6
    Senior Member
    Join Date
    Feb 2024
    Location
    SLOT GACOR
    Posts
    937

    Top Rated Product Blog

    Please try Google before asking about Awesome Product Info 9b2ee98

  7. #7
    Senior Member
    Join Date
    Feb 2024
    Location
    SLOT GACOR
    Posts
    937

    Updated NTY Auto Parts Site

    For the person inquiring about latvia bmw parts, auto parts open, auto deta?as riga, l auto parts, x parts auto, an auto parts, auto carparts 24, parts european, x parts de, victor's auto parts, the auto parts, auto parts parts, I highly recommend this check this out on Corteco auto parts info or gadi ka saman, xparts com, part parts, usauto parts, car_ parts, parts lv, bmw auto salvage, auto parts it, un auto parts, es auto parts, a and e auto parts, english auto parts, on top of this clicking here about Esen auto parts info not to mention a and auto parts, auto parts parts, auto veikals riga, auto rezerves dalas riga, de auto parts, auto parts & service, auto parts de, euro auto parts, auto salvage part, auto parts on alameda, bmw auto salvage, parts and parts auto, not to mention this linked here for Corteco auto parts link which is also great. Also, have a look at this here are the findings for Esen auto parts details alongside all con part, any auto parts open, de auto parts, b and a auto parts, parts on parts, xpart, latvia bmw parts, auto e, carparts 24, x parts de, auto parts c, auto parts it, on top of this such a good point for Delphi auto parts link with 24 parts, auto salvage part, auto parts at, auto part in, part parts, bmw dismantler, open auto parts, auto parts lv, e parts lv, x parts de, xpart, bmw auto wrecking, for good measure. Check more @ High Rated NTY Auto Parts Blog 2ee98b7

  8. #8
    Senior Member
    Join Date
    Feb 2024
    Location
    SLOT GACOR
    Posts
    937

    Great Product Website

    Please try Google before asking about Top Rated Product Site d6b89d2

  9. #9
    Senior Member
    Join Date
    Feb 2024
    Location
    SLOT GACOR
    Posts
    937

    Updated Stomach Tightening Sarasota Guide

    In reply to the person inquiring about forma facial near me, exilis ultra near me, the profound rf near me, rf needling near me, facial skin tightening near me, body tightening near me, face tight near me, body contouring and skin tightening near me, I highly recommend this get the facts about Morpheus 8 Sarsota Florida info or inmode evoke near me, radio frequency microneedling near me, fibroblast cost near me, plasma tightening near me, radio frequency facial treatment near me, fibroblast therapy near me, non surgical skin tightening near me, genius rf microneedling near me, as well as this their explanation for RadioFrequency Microneedling Sarasota link on top of radio frequency facial treatment near me, nuera tight near me, ultherapy price near me, fractional rf microneedling near me, plasma pen skin tightening near me, fibroblast plasma therapy near me, exilis skin tightening near me, fibroblast skin treatment near me, and don't forget this continue about Radiofrequency microneedling near me info which is also great. Also, have a look at this this site on RF microneedling for acne scars Sarasota blog as well as face tite near me, cost of ultherapy near me, forma skin treatment near me, rf microneedling cost near me, btl exilis ultra near me, radio frequency body treatment near me, abdominal skin tightening near me, softwave therapy for face near me, on top of this official statement for Skin Rejuvenation Sarasota forum with profound laser treatment near me, face tightening procedures near me, tempsure skin tightening near me, usrf skin tightening near me, softwave therapy for face near me, exilis 360 laser near me, lutronic genius rf microneedling near me, stomach tightening treatments near me, for good measure. Check more @ New Melasma Treatment Sarasota Tips edbb9b2

  10. #10
    Senior Member
    Join Date
    Feb 2024
    Location
    SLOT GACOR
    Posts
    937

    Best Link Adipatislot Tips

    In reply to the people inquiring about rtp slot777, rtp surgaslot777, cr88 indo, rtp cakrabola, sky777 download link, sky77 gacor, rtp slot8800, joker268 link, I highly suggest this great adipati slot info or game judi, rtp slot90, pragmatic play88, rtp luck99, big777 slot link, play spin88, jackpot party slots, wyn4d, on top of this updated adipati slot blog as well as zeus gacor x500, pragmatic slot 777, rtp mantul138, online slots free spins, rtp jam gacor, game pragmatic yang gacor hari ini, judi slot77, bocoran rtp slot pragmatic hari ini 2022, alongside all this your input here about adipati slot info which is also great. Also, have a look at this he has a good point on adipati slot info alongside all rtp sensa838, gold88 slot, zeus138 main, spin138, gs508 game slot, wd89 slot, gercep 88 rtp, link judi gacor, not to mention this best adipati slot info with 88bet, rtp vipslot99, rtp sodaslot88, game terbaru pragmatic play, bookie7 slot, gadun slot minimal deposit 10rb, judi slot online pragmatic play, bandar judi 4d, for good measure. Check more @ Excellent Adipatislot Tips e98b6_b

Tags for this Thread

Posting Permissions

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