Hi
I need to find out if a specific cmd window is opened on the pc, and I need to hide it
I looking for that cmd window by its name (cause i know it )
Ive used the EnumWindows with a callback function:
BOOL vFound=((::EnumWindows(mFindWindowOnlyByCustomTitle,0)));
and this is the CALLBACK function code
BOOL CALLBACK mFindWindowOnlyByCustomTitle(HWND hwnd, LPARAM lParam)
{
CFileException ex;
TCHAR buf[256] = {'\0'};
::ZeroMemory(buf, 256);
::SendMessage(hwnd, WM_GETTEXT, 256, (LPARAM)buf);
if (strlen(buf) > 0)
{
CFile vSourceFile;
vSourceFile.Open(buf, CFile::modeRead | CFile::shareDenyWrite, &ex);
if (strstr(buf,aName)!=NULL)
{
HWND hWnd = FindWindow(NULL, buf);
if(hWnd){
return FALSE;
}
}
}
return TRUE; // process more windows
}
the problem is that after the ::SendMessage(hwnd, WM_GETTEXT, 256, (LPARAM)buf); line
buf got a partial string of the window title (it cuts first characters) for example instead of "Continue" it hold "inue" and etc....
what could be the problem?
Thanx ahead?