HELP - C++ Cpu Usage %100 Problem.

08/22/2013 22:48 -Zynel*#1
#Solved thanks to helps :)
08/22/2013 23:26 Tasiro#2
Just a question, why not #include <thread> and #include <thread> and then use std::thread and std::this_thread::sleep_for or std::this_thread::sleep_until with std::chrono::seconds (1)?

I cannot reproduce that behavior. The reason is somewhere else. Maybe in //Somethings?
08/22/2013 23:31 -Zynel*#3
Quote:
Originally Posted by Tasiro View Post
Just a question, why not #include <thread> and #include <thread> and then use std::thread and std::this_thread::sleep_for or std::this_thread::sleep_until with std::chrono::seconds (1)?

I cannot reproduce that behavior. The reason is somewhere else. Maybe in //Somethings?
Somethings example: a += 1;
08/22/2013 23:39 qkuh#4
What happens if you leave "something" out?
08/22/2013 23:44 -Zynel*#5
Quote:
Originally Posted by qkuh View Post
What happens if you leave "something" out?
Again problem :(
08/22/2013 23:49 Schlüsselbein#6
Show your whole code.
08/22/2013 23:54 -Zynel*#7
Quote:
Originally Posted by Schlüsselbein View Post
Show your whole code.

Example Full Code:
PHP Code:
#include <windows.h>  
#include <tlhelp32.h>  
#include <shlwapi.h>  
#include <tchar.h>
#include <conio.h>  
#include <stdio.h>
#include <Windows.h> 

#include <stdio.h> 
#include <cstdlib> 
#include <iostream> 
#include <time.h>
#include <tlhelp32.h> 
#include <string> 
#include <string.h> 
#include <iostream>
#include <windows.h>
#include <stdlib.h>
#include <cstdlib>
#include <string>
#include <Shellapi.h>
#include <windows.h>
#include <string.h>
#include <string>
#include <time.h>
#include <iostream>
#include <iostream>
using namespace std;
#include <fstream>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <windows.h>
#include <tlhelp32.h>
#include <sys/stat.h>
#pragma comment (lib, "user32.lib")

int val 0;
void mythread(){
while(
1){
val += 1;
If(
val 10000){
    exit(
0);
}
Sleep(1000);
}
}
void mythread2(){
while(
1){
int val;
ReadProcessMemory(GetCurrentProcess(),(LPVOID)0x513612,&val,sizeof(val),NULL);
If(
val 500){
    exit(
0);
}
Sleep(50);
}
}
  


BOOL APIENTRY DllMainHANDLE hModule
                       
DWORD  ul_reason_for_call
                       
LPVOID lpReserved
                     
)
{
    switch (
ul_reason_for_call)
    {
        case 
DLL_PROCESS_ATTACH:
            
CreateThread(NULLNULL, (LPTHREAD_START_ROUTINE)mythread2NULLNULLNULL);
            
CreateThread(NULLNULL, (LPTHREAD_START_ROUTINE)mythreadNULLNULLNULL);
        case 
DLL_THREAD_ATTACH:
        case 
DLL_THREAD_DETACH:
        case 
DLL_PROCESS_DETACH:
            break;
    }
    return 
TRUE;

08/23/2013 00:00 Padmak#8
That's possibly the worst code i've seen in a while. That doesn't even compile, I don't know what you are trying to achieve with this code..
Shouldn't you learn the basics first?

Padmak
08/23/2013 00:02 -Zynel*#9
Quote:
Originally Posted by Padmak View Post
That's possibly the worst code i've seen in a while. That doesn't even compile, I don't know what you are trying to achieve with this code..
Shouldn't you learn the basics first?

Padmak
Thx padmak.
But I making hacks & programs old 6 month but I have cpu problem :(

I need alternative.


Solved! I use timer :)