Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: New to C#

  1. #1
    Junior Member
    FrequentlyX is offline

    Posts
    7

    New to C#

    Hello,

    i was wondering if anyone could help me out here, im new to C#, however i have been programing in Python, Matlab and Java, so i am not a complete beginer,

    my question is, how do i send key presses in C# and move the mouse and click ?

    in java its quite simple, but i dont know how it is in C#, in java, i used to Send a key, delay for a certain amount of time, and then release the key, is it the same in C# ??

    if so, could anyone give me a simple example ? including in what "must" be in the code for the program to run

    another thing i was wondering about, i was reading another thread, and i saw someone who checked the source code and posted this
    "Beware it has no HMM and will most likely get you banned."

    what is HMM ??

    Cheers
    /Andy

  2. #2
    Member
    mole3216 is offline

    Posts
    53
    Quote Originally Posted by FrequentlyX View Post

    another thing i was wondering about, i was reading another thread, and i saw someone who checked the source code and posted this
    "Beware it has no HMM and will most likely get you banned."

    what is HMM ??

    Cheers
    /Andy
    HMM stands for Human Mouse Movement.. IE a computer would just draw a straight line to a target area while a person would be a curved line and would have a jagged line

  3. #3
    Junior Member
    FrequentlyX is offline

    Posts
    7
    Quote Originally Posted by mole3216 View Post
    HMM stands for Human Mouse Movement.. IE a computer would just draw a straight line to a target area while a person would be a curved line and would have a jagged line
    Ooh

    well that clears that up thank you

  4. #4
    Member
    mole3216 is offline

    Posts
    53
    Quote Originally Posted by FrequentlyX View Post
    Ooh

    well that clears that up thank you
    no problem if you come across any other problems feel free to ask.
    as for the C# i do not know C# all that well and the best thing i can do is point you to this mousemove - C# Move Mouse to Position and Left Click - Stack Overflow
    if you need any java help im your man lol

  5. #5
    #Return
    Scarecrow is offline

    Posts
    3,443
    Quote Originally Posted by FrequentlyX View Post
    Hello,

    i was wondering if anyone could help me out here, im new to C#, however i have been programing in Python, Matlab and Java, so i am not a complete beginer,

    my question is, how do i send key presses in C# and move the mouse and click ?

    in java its quite simple, but i dont know how it is in C#, in java, i used to Send a key, delay for a certain amount of time, and then release the key, is it the same in C# ??

    if so, could anyone give me a simple example ? including in what "must" be in the code for the program to run

    another thing i was wondering about, i was reading another thread, and i saw someone who checked the source code and posted this
    "Beware it has no HMM and will most likely get you banned."

    what is HMM ??

    Cheers
    /Andy
    Hi! Nice to see some more people learning the great language that is C#!!!
    HMM stands for Human Mouse Movement as someone previously posted. I can show you some open source HMM in private if you'd like.

    As for KeyPressing;

    Code:
      [DllImport("user32.dll", SetLastError = true)]
            static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
    
            public const int KEYEVENTF_EXTENDEDKEY = 0x0001; //Key down flag 
            public const int KEYEVENTF_KEYUP = 0x0002; //Key up flag 
            public const int VK_RCONTROL = 0xA3; //Right Control key code 
    
            public void pressRightControl()
            {
                keybd_event(VK_RCONTROL, 0, KEYEVENTF_EXTENDEDKEY, 0);
                Thread.Sleep((new Random()).Next(30, 40));
                keybd_event(VK_RCONTROL, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
            }
    (You can get the codes for the various keys here; Virtual-Key Codes (Windows) just change the "public const int VK_RCONTROL = 0xA3; //Right Control key code " line )

    and mouse clicking;

    Code:
            [DllImport("user32.dll")]
            static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData,
              int dwExtraInfo);
    
            [Flags]
            public enum MouseEventFlags : uint
            {
                LEFTDOWN = 0x00000002,
                LEFTUP = 0x00000004,
                MIDDLEDOWN = 0x00000020,
                MIDDLEUP = 0x00000040,
                MOVE = 0x00000001,
                ABSOLUTE = 0x00008000,
                RIGHTDOWN = 0x00000008,
                RIGHTUP = 0x00000010,
                WHEEL = 0x00000800,
                XDOWN = 0x00000080,
                XUP = 0x00000100
    
            }
            public static void MouseClick()
            {
                mouse_event((uint)MouseEventFlags.LEFTDOWN, 0, 0, 0, 0);
                Thread.Sleep((new Random()).Next(30, 40));
                mouse_event((uint)MouseEventFlags.LEFTUP, 0, 0, 0, 0);
            }
    If you need anymore help with C# please feel free to add me on Skype; TheScarecrow-BotSupply. I can help you out with anything to do with bot coding Cheers

  6. #6
    Junior Member
    FrequentlyX is offline

    Posts
    7
    wow,
    you guys are very helpful and friendly, i will make sure to add you tomorrow, its currently really late and i should of been in bed a long time ago,

    thank you guys

  7. #7
    Junior Member
    alfonzo is offline

    Posts
    27
    Alfonzo the lord is hither to help thee. ask me your questions and I will help you amazingly!

  8. #8
    Banned
    Doge is offline

    Posts
    178
    I'm a newbie at coding and can't really help but Thenewboston has some greats tutorial on youtube you should check him out.

  9. #9
    Junior Member
    FrequentlyX is offline

    Posts
    7
    Hey guys, there is another question on my mind

    i was not able to do this in Java, but i hope someone knows how to do it in C#,

    when making a bot, how can i make sure, (if the bot is pressing a key) it presses the key on the process that it should be doing it in.

    like if i start up a game, lets say i make the the bot press the number 1 key every 10 sec, but i want to open up lets say word, and start doing other stuff, while the bot is continuing to press number 1 key.

    is that possible ?

    Cheers

  10. #10
    #Return
    Scarecrow is offline

    Posts
    3,443
    It's called Multi-Threading and yes you can do it in Java.

    Java - Multithreading Programming Tutorial

    Threading (C# and Visual Basic)

    You could also use timers, but learning to Multi-Thread is a lot more efficient and cleaner.

Page 1 of 2 12 LastLast

Posting Permissions

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