Finding a 'Microsoft Windows' window
I have a program which grabs information from a program and then places it into a database. Currently I am trying to upgrade the legacy code, unfortunately some of this is beyond my skill level :(
The old code injects a DLL into a running window, which worked fine until the program it was hooking into upgraded. Now the name of the program changes and it also opens a new window which I think confuses the DLL.
The old code is as follows -
Now the title of the program at the top of the window can be "Practice makes perfect", or "Practice, we all need it" e.t.c The only thing they have in common is that they all start with the word "Practice", so I tried the following line of code
HWND hWnd = ::FindWindow(NULL, "Practice");
GetWindowThreadProcessId ( hWnd, &idProcess );
which doesn't work :(
HWND hWnd = ::FindWindow(NULL, "Practice*");
My questions are -
A) How do I find out what the name of a window is for DLL injection purposes?
B) Does (NULL, "Practice*") actually work or should it be something else?
C) How can I get it working if the window changes it's name or is it that once the DLL is hooked it doesn't matter?