What I'm trying to do is make an application that, when launched for a second time, will detect a previous instance of that application and bring it to the front then close (since the second instance is not needed).
I have code that does this with my older compiler, but it's not working now with Borland C++ Builder 4.
Here is the previous code:
prevhwndMain = FindWindow("TApplication",NULL);
MessageBox (NULL, "UNABLE TO BRING TO FRONT", szAppTitle, MB_ICONEXCLAMATION | MB_OK);
MessageBox (NULL, "INVALID WINDOW HANDLE", szAppTitle, MB_ICONEXCLAMATION | MB_OK);
Now I'm pretty sure the other code will still work, except for what's going on with FindWindow. That has to change. After playing with it for a while I determined that the class name was TApplication (I could be wrong though...). However, I can't seem to figure out the window name. I tried Application->Name (then converted to a char *), but that always got an empty string.