//-新建一窗口,上面放置一按钮对象cb_msg
cb_msg的click事件代码-
Open('msg','这是一个测试关闭消息窗口的例子')
//---在窗口Local external Functions声明以下API函
Function long FindWindowA (String lpClassName , String lpWindowName ) Library "user32.dll"
Function boolean IsWindow (Long hwnd ) Library "user32.dll"
//---窗口的open事件代码
Timer(2)//触发关闭消息窗口代码的时间间隔
//---Timer事件代码
Ulong handle
String ls_null
SetNull(ls_null)
//获得该消息窗口的句柄
handle = FindWindowA(ls_null,'msg')//字符串"msg"为消息窗口的标题名称
If Iswindow(handle) Then
//向WINDOWS发送消息关闭窗口,256为wm_keydown消息的整型值
Post(handle,256,13,0)
End If
关闭窗口API示例
本文提供了一个使用API函数FindWindowA和Post实现自动关闭自定义标题名为'msg'的消息窗口的示例。通过设定计时器触发关闭操作,演示了如何在指定时间内关闭窗口。
855

被折叠的 条评论
为什么被折叠?



