Improved wxExecute function.