用winform.hitCaption()可以很方便的实现该功能.

//创建类似于百度网盘那样可拖动的悬浮窗(*更简便的方法)
import win.ui;
/*DSG{{*/
var winform = win.form(text="";right=60;bottom=60;bgcolor=8421376;border="none";max=false;min=false;mode="popup";title=false)
/*}}*/

winform.wndproc = function(hwnd, message, wParam, lParam) {
select(message) {
case 0x201/*_WM_LBUTTONDOWN*/{
//点击左键移动窗体
winform.hitCaption()
}
case 0x205/*_WM_RBUTTONUP*/{
//右键菜单
var popmenu = win.ui.popmenu(winform);
popmenu.add('关闭',
function(id) {
win.close(winform.hwnd);
})
popmenu.popup()
}
}
}
win.setTopmost(winform.hwnd); //窗口置顶
winform.show();
win.loopMessage();