How to get name of Window?

Hi guys. I have such decent problem. In my code I would like to capture screen in Firefox Browser Window using OpenCV. The problem is that the result of FindWindow is nullptr so the app crashes. I don't see the title of the Window. Task manager shows: "My chat with Bill Warner ... and so on" (it is long). How Can I found Window if I know it start "My chat"... without the need to specify complete string of the Window title?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "screen_capture.h"
#include "main_screen_capture.h"

int main(int argc, char ** argv){
	HWND hWnd = FindWindow(NULL, _T("My chat") ); // get window handle
	if (!hWnd)
		return -1;
	WindowCapture cap(hWnd);
	cv::Mat dst;
	cap.captureFrame(dst);
	cv::imshow("cap", dst);
	cv::waitKey();
	return 0;
}
}


I am Using Visual Studio 2010 on Windows XP
Last edited on
closed account (48bpfSEw)
maybe you'll find the answer in the source code of winspy

http://www.catch22.net/software/winspy-17

or in the source of "wincap" on the "source" page
Last edited on
You can try the EnumWindows function. It gives you the handle to the window. With this handle you can get the Window text.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms633497(v=vs.85).aspx
Topic archived. No new replies allowed.