473,417 Members | 1,406 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,417 software developers and data experts.

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

SwissProgrammer
220 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.
Oct 4 '21 #1

✓ answered by dev7060

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.

2 5495
Banfa
9,065 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.
Oct 11 '21 #2
dev7060
636 Expert 512MB
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.
Oct 12 '21 #3

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

Similar topics

2
by: Patrick L. Nolan | last post by:
I'm trying to find a clean way to launch a Wordpad editor on Windows. By "clean", I mean that it should work on as many versions of Windows as possible, and it shouldn't require installing any...
0
by: Noam Raphael | last post by:
Hello, Do you know of a reference implementation of an import hook? I mean a class, written in Python, that imitates Python's default module loading behaviour. I mean that I would be able to...
1
by: Daniel Cagara | last post by:
Hello I get a WM_USER+1010 via PostMessage sent to my window by another process. I wanted to set a Hook to somehow catch this Message, so i did: myHook = SetWindowsHookEx (WH_MSGFILTER ,...
3
by: MLH | last post by:
I can open WordPad directly (Start, Run...), then open a document & click File, Send... Out goes the email without a hitch. However, if I open WordPad from Access this way... Sub...
4
by: Quentin Huo | last post by:
Hi, I created a class "myClass" and another class "mySubclass" which inherited from "myClass". In the "mySubclass", there is a public method named "methodOfSubclass(...)" which is not defined in...
19
by: Dave Raskin | last post by:
public class Base { } public class Derived : Base { } public class Service {
7
by: Michael Rodriguez | last post by:
Is this the correct way to write this? DataSet ds; try { ds = SomeFunctionThatReturnsADataSet(); // do some stuff with ds ... }
0
by: zeng.hui.stephen | last post by:
I download the demo http://msdn.microsoft.com/msdnmag/issues/02/10/cuttingedge/. I inherite the demo, and write my code. I want to use Hook to monitor C++ Edit change. I use a C# form...
2
by: bizcor | last post by:
Is it possible to do a local keyboard hook to a process running in a new thread. The process is a command line application and is instanciated when a button is pressed on the main form. I have had...
6
by: Me | last post by:
I need to be able to acces non-virtual members of sublcasses via a base class pointer...and without the need for an explicit type cast. I thought a pure virtual getPtr() that acts as a type cast...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.