Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我只想知道为什么这段代码不起作用?
HWND hWnds = FindWindow(NULL,(LPCTSTR)"Calculator");
它总是为 hWnds 返回 NULL....
知道如何解决这个问题吗?谢谢 :)
不要投射字符串。
HWND hWnds = FindWindow(NULL,_T("Calculator"));
创建一个名为“计算器”的文件夹并使用 Windows 资源管理器进入该文件夹。
现在运行您的程序 - 将返回错误的窗口句柄!
在 Windows 7 上使用 Spy++,我发现Calculator 窗口的类名是:CalcFrame。
尝试使用这个:
HWND hWnds = FindWindow(_T("CalcFrame"), NULL);