Re: SendMessage to Notepad
First, sending keystrokes won't work the way you think it will, since keystroke processing is not as easy as sending a simple message. Key up, Key Down, OnChar, plus maybe other messages all have to be sent.
Try this instead:
Send the menu command using WM_COMMAND. If the function is available from the main menu, this is the way to do what you're trying to do.
For example, to send the "Copy", you would do this:
SendMessage(hwndNotepad, WM_COMMAND, Copy_Id, NULL);
This means that you need the handle to the notepad window (hwndNotepad), and the constant used to identify the "Copy" command on the main menu (Copy_Id).
To get the identifiers for the main menu, load Notepad.exe into a resource editor, and look at the main menu resource for the identifier's "copy" and "paste".
Regards,
Paul McKenzie
Re: SendMessage to Notepad
You might not want to send Ctrl+C and Ctrl+V...If you really want to paste text try sending WM_CHAR%2
Re: SendMessage to Notepad
Try this instead:
Send the menu command using WM_COMMAND. If the function is available from the main menu, this is the easiest way to do what you're trying to do.
For example, to send the "Copy", you would do this:
SendMessage(hwndNotepad, WM_COMMAND, Copy_Id, NULL);
This means that you need the handle to the notepad window (hwndNotepad), and the constant used to identify the "Copy" command on the main menu (Copy_Id).
To get the identifiers for the main menu, load Notepad.exe into a resource editor, and look at the main menu resource for the identifier's "copy" and "paste".
Regards,
Paul McKenzie