为什么以下代码在没有窗体的程序中就会提示Handle错误

ye12 ye12 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
procedure CTall;
var
hCurrentWindow: HWnd;
szText: array[0..254] of char;
begin

hCurrentWindow := GetWindow(Handle, GW_HWNDFIRST);
while hCurrentWindow <> 0 do
begin
if (GetWindowText(hCurrentWindow, @szText, 255)> 0) and isWindowVisible(hCurrentWindow) then
hCurrentWindow := GetWindow(GetDesktopWindow(), GW_HWNDNEXT);
sendMessage(hCurrentWindow,wm_sysCommand,sc_close,0);

end;
end;


用这个代码来关闭所有已打开的窗口,为什么这个代码加到一个按纽事情就可以关闭
...全文
评论 6
收藏 已收藏
分享
返回顶部