import win.ui;
/*DSG{{*/
var winform = win.form(text="aardio form";right=759;bottom=469)
winform.add(
custom={cls="custom";text="自定义控件";left=29;top=17;right=751;bottom=461;ah=1;aw=1;z=1}
)
/*}}*/
import com
import winex
import win.debounce
winex.waitDelay=500
var wps=com.CreateObject("KWPS.Application");
var book = wps.Documents.Add() //创建工作簿
var App_hwnd= winex.waitMainWnd("OpusApp","WPS Office")
//嵌入
win.setParent(App_hwnd,winform.custom.hwnd)
var x,y,w,h=win.getPos(winform.custom.hwnd)
win.setPos(App_hwnd,0,0,w,h)
win.modifyStyle(winform.custom.hwnd,,0x2000000/*_WS_CLIPCHILDREN*/)
//嵌入外部程序,一定要附加输入队列,不然输入有关的功能就会乱套了
var tid = win.getThreadProcessId(App_hwnd)
::User32.AttachThreadInput( ..thread.getId(),tid,true);
wps.Visible=true
winform.custom.adjust = function( cx,cy,wParam ) {
if !App_hwnd return;
win.debounce(win.setPos(App_hwnd,0,0,cx,cy))
winform.custom.redraw()
};
winform.show();
win.loopMessage();