|
发表于 2013-2-8 13:06:17
|
显示全部楼层
- import win.ui;
- /*DSG{{*/
- var winform = ..win.form( max=false;right=600;bottom=400;parent=...;text="抓取网页";border="dialog frame" )
- winform.add(
- editUrl={ right=554;bottom=56;text="http://www.baidu.com";left=44;multiline=1;top=31;z=3;edge=1;cls="edit" };
- btnGet={ bottom=383;text="抓取";left=277;top=329;z=1;right=519;cls="button" };
- richedit={ bottom=310;right=554;left=44;multiline=1;top=108;z=2;edge=1;cls="richedit" }
- )
- /*}}*/
- winform.btnGet.oncommand = function(id,event){
- var 网页源码=win.invoke(
- function( url ){
- import inet.http;
- namespace mytools{
- getHtml=function(网页地址){
- var http =..inet.http() ;
- var 网页源码=http.get(网页地址);
- return 网页源码;
- }
- }
-
- return mytools.getHtml(url);
- },winform.editUrl.text
- )
- winform.richedit.text=网页源码;
- }
- winform.show();
- win.loopMessage();
复制代码 数据应当一个入口一个出口,外部对象应当使用函数参数传递,
winform是一个局部变量,不应跨文件访问,UI线程的UI对象不应当直接传入其他线程使用,应当将控件句柄作为创建线程的参数传入线程,通过句柄跨线程控制控件。在你的这个程序里应当先取值作为参数传入,不要把简单的事搞复杂。 |
评分
-
查看全部评分
|