Click here to Skip to main content
15,220,225 members
Rate this:
Please Sign up or sign in to vote.
I want to be able to edit text (strings) of programs which I run on windows. I have a program for this. But It doesn't work for some programs. It works like this:

before edit
after edit

When I run this software then press alt + right click any text on any windows (like this installer) it change like that.

I wonder how can I develope a program like this? I know C#. I'm a software engineering student. So I'm not stranger to programming. I need help to figure out the roadmap of this work. What do you think about it? Which language should I use? And what is the basics of this issue? Every idea/comment is valuable for me.

Thanks in advance.

What I have tried:

I searched how works memory changer programs.
Richard MacCutchan 27-Apr-20 3:56am
It is very difficult to change the memory of a running program. You can sometimes change the text of a control on the active Window, but the application is still free to change it back to its correct value. Unless you know the exact structure of the application in question it is most likely not going to work most of the time.
pybll 27-Apr-20 9:44am
Thank you for your comment. But I want to change strings only for current session, only for one time momentarily. not for source code.
Richard MacCutchan 27-Apr-20 10:51am
So you will need to use the FindWindow function to find the Window handles of the controls and use the SetWindowText function to change it. But, as I already mentioned, that does not guarantee that it will keep the text that you put there.
pybll 27-Apr-20 11:13am
Is it possible to access windows of other applications with these functions?
Richard MacCutchan 27-Apr-20 12:04pm
Yes, by using P/Invoke, see findwindow (user32)[^].
Stefan_Lang 27-Apr-20 6:22am
There is no guranteed way to achieve this without changing the actual source code of the program.

There at least two obstaces to your idea:
1. While Microsoft specifies how resources such as strings are supposed to be handled, there are lower level methods to achieve the same, and programs could use any of those other methods. The program could even store and redraw everything as an image, rather than storing it as a string!
2. The memory that a program uses has very restricted access from other programs. That is a matter of security: if any program could simply modify the memory of another program, it could do all kinds of malicious stuff!
3. While memory addresses used to correspond to phyical addresses 30 years ago, nowadays only the memory manager knows the true physical address. Therefore, even if you find a physical address that you can modify to change a currently running program in any way, it will not work the next time you start that program, because then all addresses will be different! These kind of techniques may work on some embedded systems which do not use virtual memory addresses, but not on modern operating systems.
pybll 27-Apr-20 9:44am
Thank you for your comment. But I want to change strings only for current session, only for one time momentarily. not for source code.
Dave Kreskowiak 2-Jul-20 1:09am
It doesn't matter that it's "only for current session and only for one time". It is extremely difficult to do this. There are a number of different ways applications can store strings in memory. What may work for one string in one app may not work for another string in another app.

The technique you find works for one application may not work for another.

FindWindow and SetWindowText will not change the data string in an arbitrary address in memory. It will only change the DISPLAYED string in a control and that's not even guaranteed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100