We can set window text with:
BOOL WINAPI SetWindowText(
__in HWND hWnd,
__in_opt LPCTSTR lpString
);
and this windows text by another application
int WINAPI GetWindowText(
__in HWND hWnd,
__out LPTSTR lpString,
__in int nMaxCount
);
I don’t want to change my forms caption but I want to keep a custom text in window and get this text by another instance of same program. How can I achieve this?
A simple way to do this is:
This scheme allows you to send arbitrary data (as long as it doesn’t include pointers) provided that the data is reasonably small (say a few KB tops). It’s also easy to implement. What it does lack is security controls, so if you have to prevent the bad guys from retrieving this data from your application you will need to use something more heavy-duty.