使用和不使用Windows API关闭窗口 [英] Closing windows using and not using Windows API

查看:345
本文介绍了使用和不使用Windows API关闭窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道我们如何使用或不使用Windows API来关闭特定窗口.我知道如何获取Windows handle(hWnd),所以我想我可以用它来做一些事情.我使用winAPI的函数DistroyWindow(IntPtr hWnd),但是什么也没有发生.

I want to know how we can close a specific window using or not using windows API. I know how to get the windows handle(hWnd), so i think I can use it to do something. I use the winAPI''s function DistroyWindow(IntPtr hWnd) but nothing happen. help me there!!!

推荐答案

向窗口发送(或发布)WM_CLOSE消息.
Send (or post) a WM_CLOSE message to the window.


John是对.
将WIN32 API中的SendMessagePostMessage函数与WM_CLOSE消息一起使用.
John is right.
Use SendMessage or PostMessage functions from WIN32 API with WM_CLOSE message.


这篇关于使用和不使用Windows API关闭窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆