Link to home
Start Free TrialLog in
Avatar of Valleriani
VallerianiFlag for Sweden

asked on

FindWindow - Finding a name that is 'partial' to the window name C++

I am trying to find a process name that may have a different version number, for example:

HANDLE test = FindWindow(TEXT("Test Window"), NULL);
if(test)
  return true;

Will find a window that is called "Test Window"... However, what if there is a number that changes once and awhile, for example:

"Find Window v1.2"
"Find Window v1.3"
"Find Window Beta"

What I'd want is it to return TRUE for all these of these. Basicly like if a partial name is found it should return TRUE, otherwise false.

Anyone got any suggestions?
ASKER CERTIFIED SOLUTION
Avatar of evilrix
evilrix
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Valleriani

ASKER

I have some following code attached.

For some reason this gives me a debug error of: i386/chkesp.c

"The value of the ESP was not properly saved across a function call..."

Any suggestions?
BOOL EnumWindowsProc(HWND hWnd, long lParam)
{
	char Buff[255];
 
	GetWindowText(hWnd, Buff, 254);
	if (strncmp (Buff,"Test Window xxx",11) == 0)
	  return TRUE;
}
 
BOOL FindProcess()
{
	EnumWindows((WNDENUMPROC)EnumWindowsProc, 0);
		return TRUE;
}

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial