you dont' need a wait, just let it keep looping, break; out of the loop when GetModuleHandle returns true.