I have a c++
console application which creates an opencv
window.
I'm using cvWaitKey(1)
in order to catch keyboard key presses.
Here's what I would like to do:
When the user presses the s
key, I would like him to type-in something in the console. However, for that, after pressing s
he needs to manually click the console window (in order to put the focus on it), and then he can type in the text.
Is it possible to transfer the focus to the console which generated the opencv image, and then transfer it back to the opencv window?
For windows check
HWND WINAPI GetConsoleWindow(void);
,
HWND WINAPI FindWindow(
_In_opt_ LPCTSTR lpClassName,
_In_opt_ LPCTSTR lpWindowName
);
and
BOOL WINAPI SetForegroundWindow(
_In_ HWND hWnd
);
methods.
Opencv windows have "HighGUI class" class name.