
import win.ui;
import win.ui.menu;
import com.picture;
/*DSG{{*/
var winform = win.form(parent=...; top=0;min=1;bottom=156;max=1;right=330;left=0;text="AAuto Form" )
winform.add( 
button2={ bottom=113;right=248;left=96;top=82;z=1;text="最简单的汽泡提示范例";cls="button" };
button={ bottom=68;right=248;left=97;top=37;z=0;text="弹出汽泡提示";cls="button" }
)
/*}}*/

winform.button2.oncommand = function(id,event){
	var info = /*import win.util.tray; 
win.util.tray.pop("这是最简单的汽泡提示
不需要设定任何参数","AAuto"  )
*/
	import win.util.tray; 
	win.util.tray.pop(info,"AAuto"  )

	
}//endproc


winform.popmenu = win.ui.popmenu(winform);//创建弹出菜单
winform.popmenu.add('&open',function(id){
	//在下面输入菜单响应代码
	
});
winform.popmenu.add();//分隔线
winform.popmenu.add('&exit',function(id){ winform.close() })
 

winform.wndproc = function(hwnd,message,wParam,lParam){

	select(message) {//判断消息类型
		case( 0x400+9981/*_WM_TRAYMESSAGE*/ ) { //托盘图标消息
		
	    	if( lParam = 0x205/*_WM_RBUTTONUP*/ ){
	    		import mouse;
	    		x,y = mouse.getPos();
	    		
	    		//弹出托盘菜单以前，一定要前置主窗口中，不然不点击菜单不会消失
	    		win.setForeground(winform.hwnd)
	    		winform.popmenu.popup( x,y,true )
	    	}
		} 
		case( 0x112/*_WM_SYSCOMMAND*/ ){ //系统命令消息
			if( wParam == 0xF020/*_SC_MINIMIZE*/ ){ //用户点击了最小化按钮
				
				import win.util.tray;
				tray = win.util.tray(winform) //创建托盘图标 
				tray.pop("我最小化并跑到托盘来了" )
            	winform.show(false); //隐藏窗口
            	return true;//阻击默认消息传递，取消最小化过程
			} 
		}
	}
	
	//无返回值则继续调用默认回调函数
}//endproc

winform.button.oncommand = function(id,event){ 
tray = win.util.tray(winform,130)
	 tray.pop("欢迎使用托盘图标","AAuto")
}//endproc
 

import win.util.tray;
 
tray = win.util.tray(winform,0) //创建托盘图标
tray.message = 0x400+9981/*_WM_TRAYMESSAGE*/
tray.tip = "鼠标提示" //设置鼠标提示  
			
winform.show(true)  
win.loopMessage();
