Reputation: 117
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 :)
Upvotes: 0
Views: 6404
Reputation: 18411
Make a folder named 'Calculator' and enter into it using Windows Explorer.
Now run your program - wrong window handle would be returned!
Using Spy++ on Windows 7, I found out class-name of Calculator window to be: CalcFrame.
Try using this:
HWND hWnds = FindWindow(_T("CalcFrame"), NULL);
Upvotes: 0
Reputation: 190925
Dont cast the string.
HWND hWnds = FindWindow(NULL,_T("Calculator"));
Upvotes: 4