Windows programming

Moderators: None (Apply to moderate this forum)
Number of threads: 3711
Number of posts: 9173

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Sending messages to another program Posted by guojing78 on 16 Jan 2003 at 7:27 PM
How can I send messages (keyboard & mouse messages) to another program? I am writing a program where I need to control MS Word or Wordpad FROM my program, after I open MS Word from my program.
Report
Re: Sending messages to another program Posted by velius on 16 Jan 2003 at 7:57 PM
You would need to find the window with:
HWND FindWindow(
  LPCTSTR lpClassName,  // pointer to class name
  LPCTSTR lpWindowName  // pointer to window name
);

Which case you would receive a handle to the window.
Then you can send a message to that window with:
LRESULT SendMessage(
  HWND hWnd,      // handle of destination window
  UINT Msg,       // message to send
  WPARAM wParam,  // first message parameter
  LPARAM lParam   // second message parameter
);




When it came down to it I dropped everything and ran.
-Ramza Final Fantasy Tactics




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.