Results 1 to 8 of 8
  1. #1
    Braco22's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    150
    Reputation
    12
    Thanks
    607

    While Loop Does Not Initialize [Solved]

    The while loop in the AutoClick function does not initialize.

    Here is my function to create thread.
    Code:
    void cBase::ThreadCreate(bool MenuVal,HANDLE hName,LPTHREAD_START_ROUTINE tName,bool& tBool,bool& hBool)
    Using the Function Above:
    Code:
    HANDLE hNames[2];
    bool hFlags[2]= {true, true};
    bool tFlags[2];
    
    int n = 0;
    int h = 0;
    int t = 0;
    Base.ThreadCreate( hack1, hNames[n++], (LPTHREAD_START_ROUTINE)AutoClick,   tFlags[h++], hFlags[t++] );
    Auto Click Function
    Code:
    void AutoClick()
    {
            MessageBoxA(0, "test1", "title", MB_ICONEXCLAMATION | MB_OK); //this works
    
    	while( tFlags[1] )
    	{
            MessageBoxA(0, "test2", "title", MB_ICONEXCLAMATION | MB_OK); //this does not activiate
    
    		Sleep(1000);
    	}
    }
    Last edited by Braco22; 08-31-2011 at 02:51 PM.

  2. #2
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Because you haven't initialized tFlags array.

  3. #3
    Braco22's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    150
    Reputation
    12
    Thanks
    607
    Quote Originally Posted by Hassan View Post
    Because you haven't initialized tFlags array.
    Yes I have.

    Base.ThreadCreate( hack1, hNames[n++], (LPTHREAD_START_ROUTINE)AutoClick, tFlags[h++], hFlags[t++] );

    and in the CreateThread function it maks tFlags[1] = true.

  4. #4
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Quote Originally Posted by Braco22 View Post
    Yes I have.

    Base.ThreadCreate( hack1, hNames[n++], (LPTHREAD_START_ROUTINE)AutoClick, tFlags[h++], hFlags[t++] );

    and in the CreateThread function it maks tFlags[1] = true.
    What ? How does that initializes it ? [] operator is used to access or set a particular item. In this case, you are just accessing the 0th element of the array. h++ is post increment, not pre increment, so the value changes to 1 after this statement. /FP

  5. #5
    Braco22's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    150
    Reputation
    12
    Thanks
    607
    Quote Originally Posted by Hassan View Post


    What ? How does that initializes it ? [] operator is used to access or set a particular item. In this case, you are just accessing the 0th element of the array. h++ is post increment, not pre increment, so the value changes to 1 after this statement. /FP

    I see so i should put h = 1?

    yup this did the trick. pardon for my lack of understanding of C++..
    Last edited by Braco22; 08-31-2011 at 02:46 PM.

  6. #6
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    No Problem. So is it safe for me to mark the thread solved ?

  7. #7
    Braco22's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Posts
    150
    Reputation
    12
    Thanks
    607
    Yes thank you Hassan.

  8. #8
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    NP. /Marked Solved.

Similar Threads

  1. RRM not initialized
    By Gourav2122 in forum Hardware & Software Support
    Replies: 2
    Last Post: 12-31-2008, 10:57 AM
  2. My vip hack does not work
    By Thetoiletguy911 in forum General Hacking
    Replies: 2
    Last Post: 12-16-2008, 12:15 PM
  3. Does not work
    By nepalarmy in forum Combat Arms Hacks & Cheats
    Replies: 2
    Last Post: 10-29-2008, 04:37 PM
  4. warrock does not work fore me?
    By Thetoiletguy911 in forum Suggestions, Requests & General Help
    Replies: 2
    Last Post: 06-06-2008, 08:23 AM