You will need to use FindWindow() to get the window handle of the application's main window. You can then use that with GetWindowThreadProcessId() to get the application's thread id and then use that in the call to SetWindowsHookEx(), in the examples you have found, to monitor just that application.