Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ShellExecute Problem

Status
Not open for further replies.

paul51

Programmer
May 19, 2000
38
0
0
US
I would like to open up notepad from my S/W and print different messages. I am trying to use ShellExecute, but it is not working. Notepad is opening, but I cannot get anything to print.

ShellExecute(0, "open", "NOTEPAD.exe", 'some text to print', NULL, SW_SHOWNORMAL);

Can anyone help with this?
 
I thought it was impossible, but then I found that it does work in VB using the 'SENDKEY' command. I am hoping that VC has a comparable command.
 
SendKey is a terrible way of doing stuff. What if your destination window doesn't have the focus anymore? Your SendKey data will end up in de window that does have the focus at the time.

I never use ShellExecute; always use CreateProcess (don't know why; just a habit....). With CreateProcess(), WaitForInputIdle(), GetGUIThreadInfo() in the exact same order, you can get a handle to your notepad window with which you can use SendMessage to send text to the window (I presume....).

Greetings,
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top