I don't know what you mean by 'using directX'??

You can send keystrokes to the computer using the keybd_event API, but that has nothing to do with DirectX