运行下面的代码,可以看到文本框父窗口对象的句柄和主窗口的句柄是一样的。
import win.ui;
/*DSG{{*/
var winform = win.form(text="aardio基本控件编程演示范例";right=297;bottom=273)
winform.add(
button={cls="button";text="取控件所在的父窗口对象";left=69;top=164;right=231;bottom=198;z=2};
button2={cls="button";text="取主窗口句柄";left=70;top=207;right=232;bottom=241;z=3};
edit={cls="edit";text="简码编程 简码编程致力于零基础自学编程中文图解教程的分享与问答 www.jianma123.com";left=15;top=15;right=283;bottom=152;autohscroll=false;edge=1;multiline=1;vscroll=1;z=1}
)
/*}}*/
winform.button.oncommand = function(id,event){
winform.msgbox( table.tostring(winform.edit._parentForm),"父窗口对象:" );
}
winform.button2.oncommand = function(id,event){
winform.msgbox( winform.hwnd,"主窗口句柄为:");
}
winform.show()
win.loopMessage();