Results 1 to 5 of 5
  1. #1
    Combatant's Avatar
    Join Date
    Aug 2008
    Gender
    female
    Posts
    143
    Reputation
    11
    Thanks
    64

    How would I use SuspendThread and ResumeThread?

    I've been reading up on google and such, but I haven't found anything related to what I'm looking for. MSDN even said that SuspendThread and ResumeThread has been deprecated, so if there's a better alternative, please inform me.

    I'm using the following snippet to create a thread in main.cpp:
    Code:
    CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&AutoAttack, hWnd, 0, 0);
    AutoAttack is declared in bot.cpp. What I'm trying to do is make it so that an autobuff thread will suspend the thread if it's active, send the buff key, then allow the attack thread to resume. A simple example or push in the right direction would be greatly appreciated.

  2. #2
    B1ackAnge1's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Posts
    455
    Reputation
    74
    Thanks
    344
    My Mood
    Cynical
    Just to be clear - you're running 2 threads say A & B, and when 'A' gets some kind of event, it should pause 'B', do it's thing and then restart/continue B?

    Easiest way is probably instead of a thread to actually put the B(autoattack) in a timer callback with a very short interval. Then when your event A happens (autobuff thingie), simply pause the timer.

    Another possible way would be to use a mutex/waitforsingleobject combination where the primary thread locks the mutex every time the event happens (infinite wait) and secondary thread in each cycle tries to lock the mutex (0 wait) and release it right away, allowing it to run only when the primary thread isn't doing it's thing and already has the mutex locked.

  3. #3
    Combatant's Avatar
    Join Date
    Aug 2008
    Gender
    female
    Posts
    143
    Reputation
    11
    Thanks
    64
    That's exactly what I'm doing, and I'll test out both suggestions later on when I get a chance to. Thanks for the input though

  4. #4
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    Shouldn't it be
    Code:
    CreateThread(0, 0, (LPTHREAD_START_ROUTINE)AutoAttack, hWnd, 0, 0);
    Thats how I always use it(without a & sign)
    Ah we-a blaze the fyah, make it bun dem!

  5. #5
    Combatant's Avatar
    Join Date
    Aug 2008
    Gender
    female
    Posts
    143
    Reputation
    11
    Thanks
    64
    I don't think it matters, and I've figured it out already. Thanks for the suggestions guys, but I ended up using SuspendThread() and ResumeThread() in the end.

Similar Threads

  1. [Help Request] How do i use hfssign and VZipFlip?
    By Centaurus in forum Vindictus Help
    Replies: 3
    Last Post: 05-09-2011, 10:16 PM
  2. How do u use aimbot's and opk's?
    By apeguy in forum Combat Arms Help
    Replies: 23
    Last Post: 02-27-2010, 10:07 AM
  3. How Would I Use MySql To Make A Login System In VB 2008?
    By Ragehax in forum Visual Basic Programming
    Replies: 5
    Last Post: 11-21-2009, 03:09 PM
  4. (help) i got mhs and CE how do i use?
    By hotfudge2100 in forum Combat Arms Hacks & Cheats
    Replies: 3
    Last Post: 09-20-2008, 07:48 PM
  5. How would Iwins Bypass be used?
    By noooblaggers in forum Combat Arms Hacks & Cheats
    Replies: 11
    Last Post: 08-28-2008, 02:45 PM