------------------------
Also.. This bit is not all that important, but it's cuious nonetheless. This code won't cause any problems with your program but it's good to know this anyway:
1 2 3 4
char WindowTitle [Buffer]; // <-- type char* (LPSTR)
//..
if (!(CurrentConsoleHwnd = (HWND)GetConsoleTitle ( (LPWSTR)WindowTitle, Buffer))) // <-- casting to type LPWSTR
I'd recommend doing one of the following:
1) use TCHAR instead of char for WindowTitle and don't cast WindowTitle at all (recommended)
or
2) cast WindowTitle to (LPSTR) instead of (LPWSTR)
I was going to write a big long post about what the differences are, but something like that is better suited for the Articles forum.