469,301 Members | 2,282 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,301 developers. It's quick & easy.

Hook and Subclass Wordpad from C++11 : How to do this?

SwissProgrammer
213 128KB
I would like to know how to hook and subclass Wordpad (a MS Windows 32 bit common program) with a C++11 program.

I start my program; and it opens up Wordpad; then my program gets control of Wordpad, it controls the information going into and comming out of Wordpad. I do not quite recall how to do that. It should be really simple. I am having some difficulty with this.

Help?

Thank you.
2 Weeks Ago #1
2 3897
Banfa
9,064 Expert Mod 8TB
Erm, what springs to mind is: Why?

Look, WordPad is basic and I suspect it's writers never intended that it be integrated into or with any other application. That means that you may be able to reverse engineer some control of it by working out what messages to send it but that will be hard and laborious and on top of that you have no guarantee that your reversed engineered interface won't change with each new version of WordPad.

There are other, probably better, options. For example .NET includes a RichTextBox class that embodies most of the functionality you'd find in WordPad anyway. With that you can just build the editor straight into your own app, assuming you have access to the required .NET version. Even if it is important that the editor is a separate app (for C++11 program is pure C++11?) it may still be worth creating your own editor program as then you have control of the interface between your 2 programs.

Rather generic advice I'm afraid but without a better idea of what you are trying to achieve it is hard to be more precise.
1 Week Ago #2
dev7060
501 Expert 256MB
I start my program; and it opens up Wordpad; then my program gets control of Wordpad, it controls the information going into and comming out of Wordpad.
What kind of control?

To handle the information flow somewhat maybe
- I'd look for any helpful switches/options/parameters/flags the program accepts.
- One could make use of intermediate files to transfer data to/from the program. It'd require a restart to reflect the changes made. Like $ write myfile.txt can be run after the changes have been made to the file (from the code).
- Functions like SendMessage and SendInput may prove useful.

If by 'control' you mean something like the code to be able to command WordPad in real-time, I'm not sure if that's even possible.
1 Week Ago #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Patrick L. Nolan | last post: by
reply views Thread by Noam Raphael | last post: by
1 post views Thread by Daniel Cagara | last post: by
4 posts views Thread by Quentin Huo | last post: by
19 posts views Thread by Dave Raskin | last post: by
7 posts views Thread by Michael Rodriguez | last post: by
reply views Thread by zeng.hui.stephen | last post: by
2 posts views Thread by bizcor | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.