GetShellWindow and EndTask are both Win API functions. Sorry, I don't know how to "declare" them in C++. You probably need to update your header files or something. Try downloading the Windows SDK from MSDN. Or, you could also try pasting those API's declaration from the given MSDN links to the appropriate header files. As for the "!=", I'm not sure but, try declaring the hWnds array as DWORD or UINT or even int instead of HWND. If it still doesn't work, then you could try casting the return value of GetTopWindow to int. Sorry, I'm still learning about C++...