Trying to use keyboard space input if a condition is met

Im trying to auto press the space key on the keyboard if a certain if statement condition is met. Its really that simple i just have no idea how to go about doing it. Any ideas?
You could send or post yourself a WM_CHAR message;

PostMessage(hWnd, WM_CHAR, VK_SPACE, 0);

Topic archived. No new replies allowed.