I’ll be very specific about this, this is a real question and I’m facing a real problem right now.
I don’t want to optimize my program, or my code, in order to make it run faster, its not that.
I must write a program that changes the ‘speed’ of another program.
An example for this is CE ‘speedhack’, you select a target program and makes it run faster or slower, if you’re playing a flash game in a browser you can slow down the flash plugin speed which makes the game run ‘faster’ or ‘slower’.

I know that CE does this loading a library into the other program and most certainly the library creates a thread at DllMain, DLL_PROCESS_ATTACH which will change the ‘speed’ of other threads in the program. So it doesn’t even gets to be ‘other’ application at that case.
All I want is the right direction for this, how is this ‘speed’ changed.
Please do not close my question, if you did not understand please leave a comment I’ll provide necessary details. I’m a real programmer looking for a real answer.
First of all, this “speedhack” doesn’t actually make a program run faster. It just manipulates the timers the program uses by hooking (via dll-injection). Just like the values that Java’s
System.currentTimeMillis()or C++’stime_t time; time(&time)give.A more detailed explanation can be found at Cheat Engine internals.
The formula then is
returned_time = basetime+((currenttime-basetime)*speed_factor).