如何使用Windows API创建一个窗口总是位于屏幕最上方
1个回答
展开全部
创建置顶窗口: CreateWindowEx( WS_EX_TOPMOST, ......
如果在创建窗口以后,置顶 ::SetWindowPos(hwnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE)
取消置顶
::SetWindowPos(hwnd,HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE)
用AAuto写个示范:
import win.ui;
/*DSG{{*/
var winform = win.form(
text="置顶窗口测试";
right=449;
bottom=203
)
winform.add(
checkbox={
cls="checkbox";
text="置顶此窗口";
left=109;
top=92;
right=352;
bottom=126;
z=1
}
)
/*}}*/
winform.checkbox.oncommand = function(id,event){
win.setTopmost(
winform.hwnd,
winform.checkbox.checked
)
}
winform.show()
win.loopMessage();
如果在创建窗口以后,置顶 ::SetWindowPos(hwnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE)
取消置顶
::SetWindowPos(hwnd,HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE)
用AAuto写个示范:
import win.ui;
/*DSG{{*/
var winform = win.form(
text="置顶窗口测试";
right=449;
bottom=203
)
winform.add(
checkbox={
cls="checkbox";
text="置顶此窗口";
left=109;
top=92;
right=352;
bottom=126;
z=1
}
)
/*}}*/
winform.checkbox.oncommand = function(id,event){
win.setTopmost(
winform.hwnd,
winform.checkbox.checked
)
}
winform.show()
win.loopMessage();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询