Do not use TCHAR* as you map key, it will only cause you pain and headaches. You will have have memory leaks and/or crashes from referring to freed memory.
TCHAR is just a typedef for char if not unicode and wchar_t if unicode.
You can do something like this
typedef std::basic_string<TCHAR> tstring;
then declare your map as
std::map<tstring,int>
Note do not use a pointer to string. You should be able to convert whatever you get back from GetWindowText into a tstring.
You can use the win32 api
tstring window_text(max_window_text,0);
auto ncount = ::GetWindowText(window_hwnd,&window_text[0],window_text.size());
if(ncount){
window_text.resize(ncount);
} else{
// handle failure
}
Doing this will save you a lot of pain.
Knowing how to go from TCHAR* to std::string/wstring is very important in being able to write good native C++ programs for Windows. This is something you need to learn, so if you are still having trouble post code and the errors. If you do not learn how to do this, I would advise you to not write your programs in Windows in C++ and instead use something like C#.