Galilea
asked on
Please, urgent : sending text to another windows application
How can i send a string of text to another windows application such as Word (i.e. Matlab). I want that everytime I
press a button a certain string, i.e. "String (return)" appears on the word screen. Anyway, some information
on the subject will be greatly appreciated 'cause it is like walking in the dark. Thank you.
jhance, I pin this question because I would greatly appreciate some help and want to get rid of all my question points. I promise you that after this I will disappear forever. All in all, thank you very much for your help, Experts Exchange has really been of great help to me, and has always guided me in the right direction.
press a button a certain string, i.e. "String (return)" appears on the word screen. Anyway, some information
on the subject will be greatly appreciated 'cause it is like walking in the dark. Thank you.
jhance, I pin this question because I would greatly appreciate some help and want to get rid of all my question points. I promise you that after this I will disappear forever. All in all, thank you very much for your help, Experts Exchange has really been of great help to me, and has always guided me in the right direction.
if you can get a handle to the window you could use SetWindowText - however that is only suitable to plain edit boxes - other windows eg word has an automation interface that you could use whether that could be DDE or COM - a good place to put text would be in to the clipboard and then you can use the paste option of the application involved to place it into your window - do yu have aparticular target in mind?
ASKER
The target is the command window itself. I just want the text to appear on the Matlab window and a return to be implemented. Can you give me some guidance on how to use the clipboard, I wil try SetWindowText and let you know how it goes. Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ShaunWilde,
Thank you very much. How can I call the paste command on the other application so that it appears? Is there any way to do this? How can I send a "Return" keystroke?
Thank you very much. How can I call the paste command on the other application so that it appears? Is there any way to do this? How can I send a "Return" keystroke?
you could send a Ctrl+V key stroke to a window if you have its handle
ASKER
Why can't I use
GetClipboardData(CF_OEMTEX T)?
Wouldn't I be able to produce the return keystroke as well?
How can I send a Ctrl+V stroke?
GetClipboardData(CF_OEMTEX
Wouldn't I be able to produce the return keystroke as well?
How can I send a Ctrl+V stroke?
ASKER
I can get its hadle using:
::FindWindow(NULL, "Matlab").
::FindWindow(NULL, "Matlab").
using SendMessage (or PostMessage) you could use WM_COMMAND and the ID of the paste command (can be got from the resources of matlab) or you could use WM_CHAR and build up the keystroke -