Search code examples
c++visual-studio-2008findwindow

FindWindow is not working?


I just want to know why this code is not working?

    HWND hWnds = FindWindow(NULL,(LPCTSTR)"Calculator");

It always returns NULL for the hWnds....

Any idea how to fix this? Thank you :)


Solution

  • Dont cast the string.

    HWND hWnds = FindWindow(NULL,_T("Calculator"));