Change Window Text from a different app.

Hi. I want to temporarily change a program window title from a different app.

If I do an enum windows, I can get the hWnd of any window.... If a user owns both apps,... and specifically gives the second application - permission - to change the window text of the first third party app..... is this doable in Windows 7 - Windows 10?

Also, I want to be able to read an open unsaved file in a different app.. Same thing. If I get permission, is this possible in Windows C++?

Thanks.
Last edited on
This is how you can change a window title:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <windows.h>
#include <iostream>

int main()
{
	LPCWSTR WindowName = L"TargetWindow";
	HWND hWnd = FindWindow( nullptr, WindowName );
	if ( hWnd )
		std::cout << "Window found!\n";
	else
	{
		std::cout << "Window not found!\n";
		Sleep( 1500 );
		return 0;
	}
	SetWindowText( hWnd, L"DesiredText" );
	std::cout << "Window text changed successfuly!\n";

	system( "PAUSE" );
}

I don't know what you mean with "doable"
Last edited on
fewdiefie - SetWindowText worked wonderfully.

Thanks a Lot.

note: Using MS VC C++ 6.0 in a Callback routine, and used
::SetWindowText(hWnd, (LPSTR)"DesiredText");
Topic archived. No new replies allowed.