Executing Tasks in a closed RDP Window

For click activity,simulate click worked in a closed RDP Window.
But sendwindow message doesn’t work.
But I must use the sendwindow message.
any idea? thanks