This won't work. Windows applications usually have several threads. You need to hook thread that has created main window. With this method you don't know what thread you have found. You know only...