Hwnd check fail :o?

08/05/2014 16:58 Terrat#1
Warum funktioniert dei Abfrage nicht ob das Fenster exestiert ?
Code:
wstring LPCWSTR_Windowname;
	HWND	HWND_Windowhwnd;
	bool	HWND_GetSucces=true;

	
	while(HWND_GetSucces)
	{
		cout << "Type in Window Name:";
		wcin >> LPCWSTR_Windowname;
		HWND_Windowhwnd = FindWindow(NULL,LPCWSTR_Windowname.c_str());
		HWND_Windowhwnd = GetWindow(HWND_Windowhwnd, GW_CHILD);

		if (HWND_Windowhwnd != INVALID_HANDLE_VALUE)
		{
			HWND_GetSucces=false;
		}
		else
		{
			wcout << "Error:Window '"<< LPCWSTR_Windowname <<"'could not found!" << endl;
			Sleep(500);
		}
	}
08/05/2014 17:33 Mostey#2
Code:
#define INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1)
ist 0xffffffff void * auf meiner Plattform.

Quote:
Originally Posted by FindWindow aus MSDN
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Check einfach ob HWND_Windowhwnd NULL ist.