problem with SendMessage
First I Get notepad's handle
HANDLE hNote = FindWindow(....)
Now Question is
When i use
it's does not work
i want to know why
Because you are posting your message to a window in a different process... SendMessage wait's for the function to return, it can't know where to return to across isolated processes thus the call fails. PostMessage does not wait for the function to return so it can succeed across the process boundary.
FWIW... if you are sending WM_KEYDOWN... don't forget to also send WM_KEYUP as any subsequent WM_KEYDOWN messages will either be ignored (creating a dead key) or cause errors in the target process.