//-新建一窗口,上面放置一按钮对象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