//手机WAP模拟器

import win.ui;
import win.util.tray
import process
/*DSG{{*/
var winform = win.form(parent=...; right=312;bottom=549;scroll=1;text="WAP模拟器 - by AAuto Quicker";max=false;cls="WAP_EXPLORER" )
winform.add(  )
/*}}*/
 
import web.form; 

//创建web窗体
var wb = web.form( winform 
	,//可输入_UIFLAG_ 前缀的常量自定义外观
	,//可输入_DLCTL_ 前缀的常量以控制下载行为
	,"Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaN95/11.0.026; Profile MIDP-2.0 Configuration/CLDC-1.1)"
	);

//使系统支持手机wml的MIME
import win.reg;
reg = win.reg("HKEY_CLASSES_ROOT\MIME\Database\Content Type\text/vnd.wap.wml")
if(!reg){
	win.util.tray.pop("程序要管理员权限,请选择管理员权限","申请管理员权限")
	if ( process.execute( io._exepath ,  ,"runas") ){ 
    	return;
	}
	else{ 
    	win.util.tray.pop("申请管理员权限失败,程序退出")
    	return;
	}

}

reg.setSzValue("CLSID","{25336920-03F9-11cf-8FD0-00AA00686F13}")
reg = win.reg("HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/vnd.wap.xhtml")
reg.setSzValue("CLSID","{25336920-03F9-11cf-8FD0-00AA00686F13}")
reg = win.reg("HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/vnd.wap.xhtml+xml")
reg.setSzValue("CLSID","{25336920-03F9-11cf-8FD0-00AA00686F13}")
reg.close()
::SendMessage(0xFFFF/*_HWND_BROADCAST*/, 0x1A/*_WM_WININICHANGE*/ )
    
//模拟NOKIA手机的请求头    
wb.addHeaders = /**
User-Agent: Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaN95/11.0.026; Profile MIDP-2.0 Configuration/CLDC-1.1)
Accept:text/vnd.wap.wml, application/vnd.wap.xhtml+xml,application/xhtml+xml, */*
VIA:HTTP/1.1 ZJHZ-PS-WAP2-GW213 (Nokia WAP Gateway4.0 CD3/ECD13_C/NWG4.0 CD3 ECD13_C 4.1.03)
X_FORWARDED_FOR:10.180.150.20
x-source-id:cmwap
x-nokia-connection_mode:TCP
x-up-bear-type:GPRS
NOKIA_GATEWAY_ID:NWG/4.1/Build4.1.03
X_WAP_PROFILE:http://nds1.nds.nokia.com/uaprof/N6670r100.xml
X_WAP.TOD_CODED:Thu, 01 Jan 1970 00:00:00 GMT
GPRS:861399999999,10.101.39.165,cmwap,unsecured
X_UP_CALLING_LINE_ID:861399999999
X_UP_SUBNO:861399999999
NOKIA_BEARER:GPRS
X-UP-CALLING-LINE-ID:861399999999
**/

//打开网站,我们看到目标网站返回的是手机客户端访问时的页面
wb.go("http://3g.qq.com/")
//显示窗体
winform.show() 
wb.wait("");//等待指定网址,可以使用模式匹配语法
 
//进入消息循环
win.loopMessage();
return winform,wb;
